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
catchforshivacatchforshiva 

How to display contact records in revers order? (Account have multiple contacts)

Hi,
I have an Account1 record under that i have 10 Contacts.
I want tow display contacts in flow charts like in attched document.
i m getting contacts records List<Contact> con{get;set;} like

public List<Contact> getAllContacts(){
try{
con=[SELECT Name FROM Contact where Account1_C='AccID']; 
return con;
}catch(Exception e){
return null;
}
}
In Page i m using <apex:repeat> i m displaying in all values.

But it need in 1st row only 7 contacts after reverse order in need display contacts,for last record i don't want arrow image.

How to do in salesforce,I know in JSP how to do using loop


RoyGiladRoyGilad

Hi

I didn't fully understood what you need but:

if you add

"ORDER BY [fieldName] DESC LIMIT 7"

to the query,  this will help you get only the last 7 contacts, and then you can add this to any chart upi 

 

catchforshivacatchforshiva

Hi,

My my requirement?like this
I have 10 records in my contact object, but I need in first row only 7 contacts after ?reverse order?
I need display contacts, for last record i don't want arrow image.?you can see the screen short as an attached.


Avidev9Avidev9

You need to work a lil on the query!

 

When you talk about order, what do you mean by it ? I mean the record should be ordered on what basis ?

 

Well A general query would be(to reverse and limit it to 7 records)

 

con=[SELECT Name FROM Contact where Account1_C='AccID' ORDER BY <Field API> DESC LIMIT 7]; 

 Where <Field API> is the api name of the field by which you want to order the records like say if you want contact to order by  "Name"

 

con=[SELECT Name FROM Contact where Account1_C='AccID' ORDER BY Name DESC LIMIT 7]; 
catchforshivacatchforshiva

Hi Avidev,

 

Whatever your said all r correct. but requirement not like that.
can you give your mail id i'll sharing my screenshort. other wise how to upload image in discussionboard,  i dn't?


Avidev9Avidev9
Just try the above query it should work.
catchforshivacatchforshiva

Hi Avidev,

That's not my requirement, give ur mail id, i'll send screen short.