-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoDataModel.read.js
129 lines (107 loc) · 3.7 KB
/
oDataModel.read.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Read Data
this.getModel().read(sRelPath, {
success: function(oResponse) {
var aChildren = oResponse.results.filter(function(obj) {
return +sClientId !== obj.client_ba_id;
});
this.setViewProperty("view", "aChildren", aChildren);
}.bind(this),
error: function(oError) {
MessageToast.show("Error Reading list of Relationships; please try again");
console.log(oError);
}
});
====================
_updateChildren: function(sClientId) {
var sRelPath = "/ClientRelationshipInput(ipi_ba_id=" + sClientId + ",ipv_current_client_only_flag='Y')/Results";
this.getModel().read(sRelPath, {
success: function(oResponse) {
//this._setList(oResponse);
var aChildren = oResponse.results.filter(function(obj) {
return +sClientId !== obj.client_ba_id;
});
this.setViewProperty("view", "aChildren", aChildren);
}.bind(this),
error: function(oError) {
MessageToast.show("Error Reading list of Relationships; please try again");
console.log(oError);
}
});
},
===================
/*
this.getModel().read(oBinding.sPath + "/EmployeeToQualificationNav", {
success: function(oData, response) {
for (var i = 0; i < response.data.results.length; i++) {
qualArray = [];
qual = response.data.results[i].Ttext + " " + response.data.results[i].Endda;
qualArray.push(qual);
}
MessageBox.information("Qualification Info:", {
icon: MessageBox.Icon.INFORMATION,
title: "Info",
details: sEmpName + " - Field Compliance Tracking" + "\n" + sQualHdr + qualArray[0]
});
}.bind(this),
error: function() {}
});
//MessageBox.information("we have " + qualArray.length);
*/
var oModel = this.getModel("weightProtocolSource");
oModel.read("/UserCalendarSet(ShortName='BMA')", {
success: function (oData, oResponse) {
console.log(oResponse);
},
error: function (oError) {
console.log(oError);
}
});
==========================================
this.getModel().read("/ClientRelationshipInput(" + sObjectId + ")/Results", {
success: function(oData, oResponse) {
this._aClientRels = oResponse.data.results;
this._printClientRels(sPath);
}.bind(this),
error: function() {
MessageBox.Error("Could not load client relationships");
}
});
if (this._sClientRels && this._aClientRels.length > 0) {
for (var i = 0; i < this._aClientRels.length; i++) {
var clientName = this._aClientRels[i].client_name;
var relType = this._aClientRels[i].relationship_type;
console.log(clientName + "=>" + relType);
}
}
_getClientRelationships: function(oEvent) {
var sClientId = oEvent.getParameter("arguments").ClientId;
this.getModel().metadataLoaded().then(function() {
var sObjectPath = this.getModel().read("/ClientRelationshipInput(" + sClientId + ")/Results");
this._bindView("/" + sObjectPath);
}.bind(this));
},
==============================
const oSapWpService = this.getModel("sapWpService");
oSapWpService.setHeaders({"Authorization": "Basic BlaBla"});
oSapWpService.read("/InsCharInfoSet", {
success: function (oData, oResponse) {
console.log(oResponse);
},
error: function (oError) {
console.log(oError);
}
});
======================================================
this.getModel().read("/QualificationLists", {
success: this._setQualifications.bind(this)
});
_setQualifications: function (oResponse) {
var aQualifications = [{
Objid: "",
McStext: ""
}];
if (typeof oResponse.results !== "undefined") {
aQualifications = aQualifications.concat(oResponse.results);
}
this.getModel("view").setProperty("/qualifications", aQualifications);
},