cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SubQuery does not work with $expand

0 Likes
916

Hi Team,

is it possible to perform a query with $expand subquery in Odata v2. I'm following this doc: https://help.sap.com/docs/btp/sap-business-technology-platform/expand-option

Query String: https://apisalesdemo8.successfactors.com/odata/v2/User?$select=city,hr&$filter=userId eq 'M2'&$expand=hr($select=city)

I'm getting this error

Could someone please guide me, what I am doing wrong here.

Accepted Solutions (0)

Answers (1)

Answers (1)

evanireland
Product and Topic Expert
Product and Topic Expert
0 Likes

Try for the first $select giving a value of city,hr,hr/city

and drop the second $select (and the parentheses), because the parenthesized nested $select is only allowed for OData V4.

(Or if the backend also allows you to use OData V4, maybe switch to V4 in which case your original query should be OK)

(My answer is only with respect to OData V2 and V4; I can't comment on what the backend will support but just what is valid syntax for V2/V4).