function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abi V 4Abi V 4 

Order by is not supporting for external object fields

when i select the picklist field and on Click of GO button it will display the page block table in my vf page. Now i wanted to display one of the field in table with ASC or DESC order.I am not able to do this with SOQL ORDER BY condition due to Order By function is not supporting for external object fields. Please suggest me how can i achieve this functionality.
 
James LoghryJames Loghry
The Order By function *is* supported in external objects.  I just tried it out, and it worked great.  Are you attempting to order on a field that isn't supported perhaps?  Is your SOQL syntax a bit off?  (Could determine that if you posted the SOQL query and a bit more info about the error you're receiving)

Alternatively, you could look at utilizing SOSL instead of SOQL.  If that doesn't work, you could dump the external data into a wrapper class in Apex, that implements the comparable interface: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_comparable.htm
Abi V 4Abi V 4
 Hi james,
Thanks for your response,Please find the below query.
ARaging=[select invoice_age__c,quick_look_id__c from ar_aging_v1__x where 
    quick_look_id__c='123456' ORDER BY invoice_age__c DESC Limit 200];
SFDCBeginner101SFDCBeginner101
Hi Abi , did the order by claiuse worked for you in external object?
I am also trying to make a query on external object but the external object is not supporting the order by clause. my soql query is very similar to the mentioned above.