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
raghu123raghu123 

grouping custom fields..

Hi Guys,

                  I Created Temp Custom Object. With Four Custom Fields Having lookups fields to other Custom Objects.

 

temp Custom Object    temp__c

Custom fields                Applicant__c,Department__c,Subject__c,Contact__c

 

From the input data(Suppose assume i entered 10 applicants info ). Now. I need to display data by grouping  Department  and Subject . Appriciate your help guys..

 

Thank You.

 

 

 

 

 

mtbclimbermtbclimber

Try this:

 

 

<apex:page standardController="Temp__c">
{!temp__c.applicant__r.name}
{!temp__c.Department__r.name}
</apex:page>

 

When you create a relationship field (lookup or master/detail) the __c variation refers to the field itself which is just the foreign key. The __r variation is the "relationship" which can be traversed per above.

 

raghu123raghu123

Thanx for your reply.But i need to group the  records.

 

For each Department           How many Applicants..??

For each Subject                  How many Applicants..??

 

   And have to show in a Table.

mtbclimbermtbclimber

Based on the info you provided and given this is the visualforce board I assumed you were just stuck on the syntax of relationships.

 

What is a "Student" and how does it relate to temp__c and/or Contact__c and/or Applicant__c? 

raghu123raghu123

My Bad.I posted in Wrong place.

 

Custom Object    Temp__c

 

Fields                    Applicant__c,Department__c,Subject__c,Contact__c  (Four are in  look up relationship with Temp__c)

 

I saved the data to Temp__c. Now  I need to get that data from Tamp_c . By Grouping Applicats by Department and Subject.

 

I need two tables

 

Table 1:                                                                            Table 2:

 

Department       No.of Applicants                               Subject         No.of Applicants

 

Thank You,

 

 

 

ngabraningabrani

In your custom controller, add a method that will return departments and their counts. In Visualforce, iterate through these departments by using apex:pageBlockTable. 

 

As an example take a look at this blog - http://astreait.com/wordpress/?p=3