on 03-10-2017 9:56 AM
Hi guys,
I have a calculaton view which is using an input parameter. The view is exposed as an xsodata sevice. Now, I want to feed data from this view into a set of tiles. The problem is the syntax when referring to specific fields from my view. I can use a syntax like "{RequestsByStatusParameters(IP_Status='02')/Results}, which gives me the "Results" collection - which in my case consists of one single element (the one with IP_Status = '02'). The problem is I cannot find a way to refer to the individual elements (fields) inside this "Results" entity...
I have found forum posts showing how to bind the entire "Results" entity to a table, but that's not what I need. I need to refer to the specific fields inside Results. If I do so, like for instance "...Results/myFieldName", I get an error stating that I can only use $count after "Results", since the "last node is a collection".
My UI5 control - a tile - looks like this:
<StandardTile
id="__RequestsInProgress"
title="In Progress"
icon="sap-icon://settings"
info="Requests"
number="{NumberOfRequests}"
infoState="Success"
binding="{/RequestsByStatusParameters(IP_Status='SG02')/Results}"
press=".onRequestsInProgressPressed"/>
To refer to the individual element you need to use OData url with Key in the url.
As for the calculation view's XSOData definition is to generate local keys, so at runtime key is generated and we don't what is the key value.
service {
"sample.odata::view" as "MyView" key generate local "GenID";
}
Only approach I could think of is to perform read operation on the model ...something like model.read() and get the results to perform binding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
since you are referring to a data set and you only need one record from the list.. you need to call your end point as you have it.. then basically take the zero index element from the array. did you try this?
/RequestsByStatusParameters(IP_Status='SG02')/Results/0
check out the element binding section:
https://sapui5.hana.ondemand.com/#docs/guide/91f05e8b6f4d1014b6dd926db0e91070.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.