3 weeks ago
Hi,
I have UI5 application that executes a GET request and returns the data to the UI as a JSONModel. I'm trying to iterate through the results to get to the data I want but am having challenges.
Below is a sample of the data with just 2 results. I'm trying to get to the oData section and I'm obviously not doing it right.
Interesting that in the Dev Tools of Chrome, it appears a little differently, showing the indexes of the array rows in oData. I put a screen shot below the JSONModel data.
Any ideas and/or suggestions anyone has would be greatly appreciated.
Thanks in advance!
Ron
***********************************************************************
JSONModel data:
{
"pSequentialImportCompleted": {},
"mEventRegistry": {},
"mMessages": {},
"id": "id-1713560453764-17",
"aBindings": [],
"oBindingsToRemove": {},
"mContexts": {},
"oData": [
{
"pipelinerunseq": 20547673299878010,
"starttime": "2024-03-05T13:05:38.693Z",
"stoptime": "2024-03-05T13:06:49.992Z",
"stagetype": "CompensateAndPay",
"status": "Successful",
"command": "PipelineRun",
"period": "June 2022",
"numerrors": 0,
"numwarnings": 2,
"time": "13:05",
"daydate": "05"
},
{
"pipelinerunseq": 20547673299878010,
"starttime": "2024-03-05T13:07:21.975Z",
"stoptime": "2024-03-05T13:08:04.098Z",
"stagetype": "CompensateAndPay",
"status": "Successful",
"command": "PipelineRun",
"period": "June 2022",
"numerrors": 0,
"numwarnings": 2,
"time": "13:07",
"daydate": "05"
}
],
"sDefaultBindingMode": "TwoWay",
"bDestroyed": false,
"bLegacySyntax": false,
"sRemoveTimer": null,
"iSizeLimit": 100,
"mSupportedBindingModes": {
"OneWay": true,
"TwoWay": true,
"OneTime": true
},
"mUnsupportedFilterOperators": {
"Any": true,
"All": true
},
"sUpdateTimer": null,
"bCache": true,
"aPendingRequestHandles": []
}
What shows in Dev Tools:
Hi Ron,
like this ?
let oData = this.getView().getModel("oDtdModel").getData();
This should give you your data as array, as seen in the dev tools.
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.