cancel
Showing results for 
Search instead for 
Did you mean: 

Using calculation view with input parameters in SAPUI5 control

Former Member
0 Kudos

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"/>

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member365727
Active Contributor

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

SergioG_TX
Active Contributor
0 Kudos

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