Skip to Content
0

Do xsodata models support nested $expand queries?

Apr 05 at 07:22 AM

57

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Thomas Jung
Apr 05 at 08:06 AM
0

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-errata03-os-part2-url-conventions-complete.html#_Toc453752359

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.

Share
10 |10000 characters needed characters left characters exceeded