5

query options in function to database query

 1 year ago
source link: https://answers.sap.com/questions/13892327/query-options-in-function-to-database-query.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
May 27 at 08:08 AM

query options in function to database query

51 Views Last edit May 27 at 08:13 AM 2 rev

Hello all,

I have defined a function that supports a filter. So far I access the filter parameters using req._queryOptions and build the select accordingly. My problem is that an additional requirement would now make this too complex.

function getNearbyPoints(latitude : Decimal, longitude : Decimal)  returns array of Records;

How can I pass the query options from the request directly into the query of the database?

I did find a topic on this here in SCN, but it is older and there was no answer.

Thanks a lot

2 comments

Cab you provide more details as to what you have in mind regarding query options? Is it just straight key value combinations or additional functionality such as filters, field selections etc?

Something like this?

http://localhost:4004/community-example/getNearbyPoints(latitude=1232.23,longitude=212.23)?Test=12¶2=13&$filter=description eq 'example record'

And then what do you want to do with the query options on the database?

yesterday

Hi Martin Stenzig ,

Exactly, it's about $select and $filter.

Based on the coordinates, points in the surroundings are determined (with a spatial function). At the moment all are returned and filtered by type, here I look into $filter myself and build the condition. Now more fields will be added, which makes it more complex to build. My thought was, if a standard entity can do all this itself, there must be a possible way to do it.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK