Question

I am building EntityQuery. Now I would like to get filter segment out of it? I know toString() will give me human readable string, but I want actual filter string that will be sent to fetch data along with URL.

Was it helpful?

Solution

The following should do it:

var queryString: string = this._manager.metadataStore.toQueryString(query);

manager being your EntityManager and query being the EntityQuery.

Result

SomeEntity?$filter=FirstFilter%2Fany(x1%3A%20x1%2FLicenseTypeId%20ne%2016730)&$expand=FirstFilter%2CFirstFilter%2FPartners%2CAddresses&$inlinecount=allpages

and here is an alternative that I don't quite like as much:

var anotherway = query._toUri(manager.metadataStore);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top