cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA With Variables

former_member221711
Active Participant
0 Kudos

Hi,

I have a scenario where i have 3 inputs from SAPUI5 application and all of them are optional.

In input parameters if i deselect the "is Mandatory" check box i need to provide a default value which would be used to fetch data incase no input was passsed from UI.

But in my scenario if input is not passed from UI entire data set has to be displayed in the front end. So i went ahead and created variables for the columns. I am unable to find how to pass the variable values in the  ODATA URL

I have gone through this thread which says it was not possible back in 2014 any changes after that ? If not is there a work around.

I am currently working on SAP HCP.

BR

Madhusudan

,

Accepted Solutions (1)

Accepted Solutions (1)

Bruhn
Explorer
0 Kudos

Hi Mate,

I am not sure if you have any option to change the UI5 call - if you have then you could consider making the check there and/or use a filter option in oData ($filter=).

You can check this direct on the XS server by accessing the URL for your oData service - below you will see me accessing one we have at the moment with a argument for selecting a project.

<prot>://<host>:<xsport>/projectDetails.xsodata/projectDetails/?$format=json&$filter=startswith(projectID,'PI.20193')

Using the startswith and leaving the identifier - in the case above projectID blank - startswith(projectID,'') should return all entries.

You can have multiple filters separated by the word "and" like this where I select all projects that are editable(a field in my table)

&$filter=startswith(projectID,'') and startswith(editable,'true')

You can see other options here : Using Filter Expressions in OData URIs and here URI Conventions (OData Version 2.0) &amp;middot; OData - the Best Way to REST

/MiB

former_member221711
Active Participant
0 Kudos

Hi Michael,

I have 3 variables and as per my knowledge we can use only 2 fields in $filter in ODATA.

Please correct me if i am wrong.

BR

Madhusudan

Bruhn
Explorer
0 Kudos

Hi again,

No it is possible to filter on several fields at the same time like the following:

$filter=startswith(projectID,'') and startswith(editable,'true') and detailID gt 1

/MiB

Answers (0)