+ Start a Discussion
Ravi_SFDCRavi_SFDC 

Visualforce Page Issue

public class accountprioritysort {
    public list<Company_Priorities__c> acts {set;get;}
    public accountprioritysort (){
        acts = [select Field1__c,Account_Priorities__c from Company_Priorities__c];
    }    
}

The Field1__c (has priority number) so i want to have the SOQL with where condition, that i want to display all the first 5 records which have Field1__c with numbers. Please see the below screen shot. Your help is really appreciated.

 

Priority

Alexander TsitsuraAlexander Tsitsura
Hello Venkata,

Do I understand correctly, that you want to retrieve first five records order by priority?

If yes, try next query:
select Field1__c,Account_Priorities__c 
from Company_Priorities__c 
order by Field1__c ASC
limit 5
If it helped you, then please select it the best answers it will help outer also.

Thanks,
Alex
Ravi_SFDCRavi_SFDC

Hi Alex, no this didn't work. Can you please suggest. 

I do have a custom sort by button, once i click on that it should fetch me by order by Field1__c. Once the first 5 records display i should be able to change the priority as needed then SAVE. Please suggest how can i achieve this.