+ Start a Discussion
Lukasz PiziakLukasz Piziak 

VF Extension formula with Sorting Option

Hi,

I have created an extension for my VF page where I'm sorting data by SCMC__Start_Date__c. My question is if its possible also to group by Sales_Order_No__c so system is dispalying valuse groupped together by Sales Order Number and Start date. 
How should I create my code to achieve that?
Below is code I'm using currently:

objlist = [SELECT Name, Sales_Order_No__c,Customer__c, Assembly_Name__c, SCMC__Start_Date__c, SCMC__Planned_Completion_Date__c, 
    SCMC__Production_Status__c FROM SCMC__Production_Order__c Where SCMC__Production_Status__c = 'Pending Pulling All Items'
    ORDER by SCMC__Start_Date__c];

Thank you for any ideas.
Regards,
Lukasz
Sunil MadanaSunil Madana
Hi, Can you try the below code?
objlist = [SELECT Name, Sales_Order_No__c,Customer__c, Assembly_Name__c, SCMC__Start_Date__c, SCMC__Planned_Completion_Date__c, 
    SCMC__Production_Status__c FROM SCMC__Production_Order__c Where SCMC__Production_Status__c = 'Pending Pulling All Items'
    ORDER by SCMC__Start_Date__c DESC, Assembly_Name__c ASC];
If the above suggestion(s) worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future.
Thanks, Sunil