cancel
Showing results for 
Search instead for 
Did you mean: 

Do xsodata models support nested $expand queries?

former_member190800
Contributor
0 Kudos

I have an odata query which I believe to be valid, which is receiving an error from my Neo XS runtime. It includes a nested $expand:

?$expand=expenseitem($expand=currency,expenseType,paymentType)&$top=20

The resultant error shows that the parenthesis are not being respected:

"Syntax error in $expand system query option at position '28': entityNavProperty 'expenseitem($expand=currency' is not a valid navigation property for type 'codejam.saptravelexpense.services.expenseReportType'."<br>

Queried independently, $expand=expenseitem on the principal expensereport, and $expand=currency,expenseType,paymentType on the principal expenseitem behave as expected.

Any guidance here?

HANA Workbench v1.120.20.

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

From what I’m reading online and in the OData specification this would seem to be a new syntax feature of OData V4. XSODATA is V2.

Here is the entire specification for $expand in OData V2:

http://www.odata.org/documentation/odata-version-2-0/uri-conventions/

ere is the same section in OData V4:

http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-er...

Note the section above about query options that can be applied to the expanded navigation.

Query options can be applied to the expanded navigation property by appending a semicolon-separated list of query options, enclosed in parentheses, to the navigation property name. Allowed system query options are $filter, $select, $orderby, $skip, $top, $count, $search, and $expand.

This is also listed in the What’s New features of OData V4:

http://docs.oasis-open.org/odata/new-in-odata/v4.0/cn01/new-in-odata-v4.0-cn01.html#_Toc366145452

2.6.4 Improved: $expand

Expanded entities can now be filtered, ordered, paged, projected, cast, … , and of course further expanded through a more composable, nested syntax.