You need to sign in to do that
Don't have an account?

How to display set of values in Ascending and Descending Order
Hi , how to display ascending order and descending order set of values in visualforce page......
apex class
===========
public class SetPrimitiveDatatype
{
public set<String> fstName{get;set;}
public set<String> lstName{get;set;}
public SetPrimitiveDatatype()
{
fstName=New set<String>();
fstName.add('Rama');
fstName.add('Anil');
fstName.add('Srinu');
fstName.add('Kumar');
fstName.add('Prasad');
fstName.add('Devaraju');
fstName.add('Murali');
fstName.add('Balu');
fstName.add('Chaitu');
fstName.add('Tanuja');
}
}
page
============
<apex:page controller="SetPrimitiveDatatype">
<apex:form >
<apex:pageBlock title="Display The Set of values">
<apex:pageBlockSection title="FirstName">
<apex:pageblockTable value="{!fstName}" var="fn">
<apex:column value="{!fn}"/>
</apex:pageblockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
please help me .............
Use "List" instead of "Set" and checkout the below link for sort function in list for sorting the values
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_list.htm
Hi , i dnt get in .........
please help me
You cannot sort the set because it a un-ordered collection.
So use list and use sort() method.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_list.htm
search for sort in this link
Hi Laxman ,
i am codeing beginner , how to use in class ,
so plz help me Laxman..............
apex class
===========
public class SetPrimitiveDatatype
{
public list<String> fstName{get;set;}
public list<String> lstName{get;set;}
public SetPrimitiveDatatype()
{
fstName=New list<String>();
fstName.add('Rama');
fstName.add('Anil');
fstName.add('Srinu');
fstName.add('Kumar');
fstName.add('Prasad');
fstName.add('Devaraju');
fstName.add('Murali');
fstName.add('Balu');
fstName.add('Chaitu');
fstName.add('Tanuja');
fstName.sort();
}
}
Hi
this the error message/..............
SetPrimitiveDatatype Compile Error: Method does not exist or incorrect signature: [SET<String>].sort() at line 20 column 9
dude use list instead of set.
do not use set.
hi Laxman ,
i wnt ASC and DESC order of set of fstname values ............
Hi laxman ,
thanku very much ..........
now completed.................
now how to view list of values in Ascending order and descending order...........