Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

StandardController ---- functionality specific

SOQL : salesforce object query language

[select fieldname from ObjectName];

[Select id,name,country__c from Account limit 1000];

[select id,name ,roll_no__c,country__c from students where country__c='US' and


Fees1__c >1];

[select id,name,industry,type from account where Industry IN ('Energy' ,


'Apparel' ,'Construction')];

[select id,name ,roll_no__c,country__c from students where name like 'b%'];

[select id,name ,roll_no__c,country__c from students order by name ASC];

[select id,name ,roll_no__c,country__c from students order by name DESC];

[select id,name ,roll_no__c,country__c from students order by createddate DESC];

Account acc = new Account ();--single instance of object

list<Account> listacc = new list<Account> (); --list instance of object

listacc=[select id,name from account];

Student__c stu = new student__c ();

list<student__c> stulist = new list<student__c>();

stulist=[select id,name from student__c ];

Constructor : whenever a visualforce page is loaded , constructor will be called


first

Public Classname(){

<apex:page showheader="True" lightningStylesheets="False" tabStyle="Student__c"


controller="customcontrollerpage_apex">

<apex:pageBlock title="My student list">


<apex:pageBlockSection title="List1" >
<Apex:pageblockTable value="{!list1}" var="ac">
<apex:column value="{!ac.Name}"/>
<apex:column value="{!ac.FeeSubmit__c}"/>
<apex:column value="{!ac.MBA_Subjects__c }"/>
</apex:pageblocktable>
</apex:pageBlockSection>
.
.
<apex:pageBlockSection title="List2">

<Apex:pageblockTable value="{!list1}" var="ac">

<apex:column value="{!ac.ID}"/>
<apex:column value="{!ac.City__c}"/>
<apex:column value="{!ac.Age__c}"/>
</apex:pageblocktable>

</apex:pageBlockSection>
<apex:pageBlockSection title="List3">

<Apex:pageblockTable value="{!list3}" var="ac">

<apex:column value="{!ac.Name}"/>
<apex:column value="{!ac.Description}"/>
<apex:column value="{!ac.Rating}"/>
</apex:pageblocktable>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:page>

public class customcontrollerpage_apex {

public list<Account>list3 { get; set; }

public list<Student__c> list1 {get;set;}

public customcontrollerpage_apex (){


list1 = new list<Student__c>();
list3 = new list<Account>();
list1 =[select id, Name, FeeSubmit__c, MBA_Subjects__c,Age__c, City__c
from Student__c];
list3 =[select id, Name, Description,Rating from Account];
}

You might also like