Closed JohnrFinney closed 2 years ago
Is there any reason your cannot use the order by as part of the query? See: https://github.com/MicrosoftDocs/powerapps-docs/blob/main/powerapps-docs/developer/data-platform/org-service/linq-query-examples.md#use-the-orderby-operator
How would it be done to dynamically set the column/columns to be ordered within the Linq query?
From: MattB @.> Sent: 11 April 2022 17:40 To: microsoft/PowerPlatform-DataverseServiceClient @.> Cc: JohnrFinney @.>; Author @.> Subject: Re: [microsoft/PowerPlatform-DataverseServiceClient] LINQ Methods and Dynamic Sorting (Issue #261)
Is there any reason your cannot use the order by as part of the query? See: https://github.com/MicrosoftDocs/powerapps-docs/blob/main/powerapps-docs/developer/data-platform/org-service/linq-query-examples.md#use-the-orderby-operator
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/PowerPlatform-DataverseServiceClient/issues/261#issuecomment-1095286889, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANJJZQNW2HM3ZJUNVQ53FIDVERIY7ANCNFSM5TBOTSGA. You are receiving this because you authored the thread.Message ID: @.***>
In that scenario you would use late bound linq queries.. see here for an example LateBoundQuery
MattB
Hi,
Using the client, I can't figure a way to use Linq Methods to do dynamic sorting. The only way I know of is using Linq query syntax and I'm getting an error ....... "The method 'OrderBy' cannot follow the method 'Select' or is not supported. Try writing the query in terms of supported methods or call the 'AsEnumerable' or 'ToList' method before calling unsupported methods."
This is the following code and the orderByDynamic works against other data sources (Ef.core).. public List ListClaimantsByClassActionId2(Guid classActionId)
{
var res = (from e in this.Context.ContactSet
join cac in this.Context.cp_classactionclaimantSet
on e.Id equals cac.cp_claimantid.Id
where cac.cp_classaction.Id == classActionId
&& cac.statecode == 0
select e).AsQueryable();
Is the problem above because there's a select in the Linq query?
My main issue is that of implementing dynamic sorting somehow.......... Does anyone have suggestions to implement dynamic sorting please?