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
dany__dany__ 

hi guys i want to display 3 objects data in readonly format in a single vf page? this 3 objects are inter related to one other

hi guys i want to display 3 objects data in readonly format in a single vf page? this 3 objects are inter related to one other  . and  we must use a standars controller  . how can this be done
Sai Ram ASai Ram A
Hello Danny

Can you describe the relation between the Objects so we can help you in acheving your requirement.
try using relationship queries - http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm

Thank you
BLearn
dany__dany__
they are having  lookup relation ship 
 
Shaijan ThomasShaijan Thomas
Use wrapper class to combain the objects
dany__dany__
@shaijan Thomas
can we write a wrapper class for a atandard controller 
 
Vijay NagarathinamVijay Nagarathinam
Hi Dany,

Try this code .
 
apex:page controller="SampleWrapperClassForThreeObjects" showHeader="false" sidebar="false"  action="{!displaydata}">  
  <apex:form >  
  <apex:pageBlock >  
   <apex:pageblockTable value="{!wct}" var="w">
   <apex:column headerValue="AccountName" value="{!w.Location}"/>
      <apex:column headerValue="CustomObjectField1" value="{!w.mobilephone}"/>
         <apex:column headerValue="CustomObjectField2" value="{!w.Category}"/>
   </apex:pageblockTable>
  </apex:pageBlock>  
  </apex:form>  
 </apex:page>
 
public class SampleWrapperClassForThreeObjects
{
    public list<Testwrapperclass> wct{get;set;}
    public class Testwrapperclass
       {
           public string name1{get;set;}
           public string email{get;set;}
           public string mobilephone{get;set;}
           public string Location{get;set;}
           public string Category{get;set;}
       }
       
       public SampleWrapperClassForThreeObjects()
       {
           wct = new list<Testwrapperclass>();
       }
       public void displaydata()
       {
           list<Account> accList = [select id,name from Account limit 5];
           list<Contact> conList = [select id,email,mobilephone from Contact limit 5];
           list<Workshop__c> wrkList = [select id,Location__c,Category__c from Workshop__c limit 5];
           
           for(Account acc : accList)
             {
               for(integer i=0;i<conList.size();i++)
                 {
                   for(Integer j=0;j<wrkList.size();j++)
                     {
                       Testwrapperclass tt = new Testwrapperclass();
                       tt.email = conList [i].email;
                       tt.mobilephone = conList [i].mobilephone;
                       tt.Location= wrkList[j].Location__c;
                       tt.Category = wrkList[j].Category__c;
                       wct.add(tt);
                     }
                 }
             }
       }
}

 
dany__dany__
but the thing is i want to use a standard controller