-
Not sure if I am missing something but when I issue a query with multiple ORDER statements, only the first one is acknowledged. If I do this is SQL4CDS, it works as expected. But then converting the SQL query to FetchXml and executing in FetchXml Builder, the results are not the same. Any ideas will be greatly appreciated. UPDATE: It appears that this is NOT a FetchXml Builder issue but FetchXml in general. Does anyone know if multiple ORDER statements are allowed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Depends on the details of the query. Generally, if you are trying to apply sorts on a link-entity, SQL 4 CDS will choose to not include that sort in the FetchXML and apply it itself as a separate process as it can lead to problems with paging. Multiple orders are allowed, and they are applied "outside-in", so any sorts on the outer-most entity are applied first, followed by those on the link-entities. There's more information on my blog Sorting on link-entities forces Dataverse to use legacy paging which limits the results to 50,000 records, so be cautious if you're expecting more than that. |
Beta Was this translation helpful? Give feedback.
Ah, you’ve found one of the wonderful oddities of the
audit
entity. There are many things that are unusual about how you can or cannot query this entity, and this is one of them.For most entities, adding two sorts as you have done is fine. For elastic tables you’ll get an error saying only a single sort is supported.
audit
is backed by the same Cosmos DB store as elastic tables but instead of producing an error simply ignores any extra sorts.