Skip to main content

subqueries-in-expand

Note that you can create very complex queries within the expand scope:

People.requestBuilder()
.getAll()
.expand(
People.FRIENDS.select(People.FIRST_NAME, People.ADDRESS_INFO)
.filter(People.LAST_NAME.equals('Miller'))
.orderBy(asc(People.GENDER))
.top(1)
.skip(1)
);

In this example, the filter will reduce the number of friends to be shown. The effect of a filter depends on whether it is used inside or outside an expand. The different cases are explained in Filters in Expand.

The URL for the query will be:

/People?$expand=Friends($select=FirstName,AddressInfo;$filter=(LastName eq 'Miller');$skip=1;$top=1;$orderby=Gender asc)