You need to sign in to do that
Don't have an account?
jaysun
getting record index / number from SOQL recordset
Is it possible to get record index using SOQL query?
i.e.
record 1 - 1
record2- 2
record -n
I want to render the record number in pageblock table or data table.
is there a way to display record index using Apex or visualforce contorls?
The quickest way I can think is to basically build a wrapper class that has your sObject and also an index. Then loop through your query and add them to the object numbering them. Maybe someone else out there has a better way.
All Answers
The quickest way I can think is to basically build a wrapper class that has your sObject and also an index. Then loop through your query and add them to the object numbering them. Maybe someone else out there has a better way.
no you can not directly, but if you create a map like
Map<Id, index>
where key is map and index is record index in the list provided by SOQL . For creating map you can iterate over list returned by soql.
Thanks...that is another way to make it work.
I craeted a wrapper class and added a property.
Both ways are finde.
Yes..it worked.
created wrapper and added index as porperty to wrapper class.