You need to sign in to do that
Don't have an account?
lakshman.matti
VF page
i have a student object.there are columns like name and marks.there are 10 records with different marks.
now i want to build a custom VF Page which outputs like below
Grade column count
-------------------------------
A' Grade 5
B' Grade 3
i hope i'm clearly conveyed my requirement.can some body guide me how to achieve this..
Regards
Lakshman
You can use Group BY clause in SOQL to get the desired result and then it would be easy to render the data on VF page.
SS
You can achieve your requirement by getting count of student records by grouping them by Marks.
Sample Soql : [SELECT Grade__c, Count(Id) FROM Student_Grades__c GROUP BY Grade__c]
After this , Loop over the aggregate result and add the results using a wrapper class into a list and display the list in the visual force page.
For reference please refer the link : http://stackoverflow.com/questions/8523303/how-do-i-display-the-results-of-an-aggregate-soql-query-on-a-visualforce-page
Please let me know if this helped you or not.
Regards
Jogendra
how to devide it into 3 grades..group by will categorize into distinct groups it will not divide result into 3 groups..
grade is not a filed here...we need to explicitly categorise them into grades based marks ranges(ex: if marks are between 70-100 then grade A,50-70 grade B,40-50 grade C like this..)
1.Create grade as a picklist with values as 'A','B','C' and 'Fail'.
2. Create 3 workflow rules respectively on students object with condition as ex: IF( CEILING( Marks__c )>40 && CEILING( Marks__c )<=50,true,false )
3. Create field updates on the grade field based on the above conditions.
4. Later follow the steps as specified by me in the above post for creating the VF page and class.
Please let me know if this has helped or not.
Thanks
Jogendra