• ravi kiran 87
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
public class YourController {

    public String GetAttributes { get; set; }
    public List<Vehicle> vehicles { get; set; }

    public YourController() {

        vehicles = new List<Vehicle>();

        List<account> cars = [SELECT Id, Name, Description FROM account];
        
        List<contact> planes = [SELECT Id, name , Title FROM contact];

        for(account car : cars) {
        system.debug('car value in the loop ---> '+car.name);
            vehicles.add(new Vehicle(car));
        }

        for(contact plane : planes) {
        system.debug('Plane value in the loop ---> '+plane.title);
            vehicles.add(new Vehicle(plane));
        }
        
    }
    
    
      public List<contact> GetAttributes(){
    List<contact> attr = [SELECT Name from contact limit 10];
    return attr;
    }
    

    public class Vehicle {
        public Id id { get; set; }
        public string name { get; set; }
        public string name1{ get; set; }

        public Vehicle(account car) {
     //       this.id = car.Id;
            this.name = car.name;
           // this.desc = car.desc;
        }

        public Vehicle(contact plane) {
       //     this.id = plane.Id;
            this.name1 = plane.title;
            //this.desc = plane.desc;
        }
    }
}


------------------

Vf Page 

<apex:page controller="YourController" >
<apex:form >
<apex:pageBlock ><apex:pageBlockTable value="{!vehicles}" var="vehicle">
   <!--- <apex:column headerValue="Id" value="{!vehicle.id}" />  --->
    <apex:column headerValue="FirstName" value="{!vehicle.name}" />
    <apex:column headerValue="Name" value="{!vehicle.name1}" />
    
    <apex:pageBlockSection title="Vitality Check Attributes">
        <apex:pageBlock >
            <apex:repeat value="{!Attributes}" var="att">
            </apex:repeat>
        </apex:pageBlock>
    </apex:pageBlockSection>
    
    
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 
I have a requirement where I have to display mutliple columns from different objects on a single VF page

i'm trying to display but the way its binding is improper.

public class YourController {

    public String GetAttributes { get; set; }
public List<Vehicle> vehicles { get; set; }

    public YourController() {

        vehicles = new List<Vehicle>();

        List<account> cars = [SELECT Id, Name, Description FROM account];
        
        List<contact> planes = [SELECT Id, name , Title FROM contact];

        for(account car : cars) {
        system.debug('car value in the loop ---> '+car.name);
            vehicles.add(new Vehicle(car));
        }

        for(contact plane : planes) {
        system.debug('Plane value in the loop ---> '+plane.title);
            vehicles.add(new Vehicle(plane));
        }
        
    }
    
    
      public List<contact> GetAttributes(){
    List<contact> attr = [SELECT Name from contact limit 10];
    return attr;
    }
    

    public class Vehicle {
        public Id id { get; set; }
        public string name { get; set; }
        public string name1{ get; set; }

        public Vehicle(account car) {
     //       this.id = car.Id;
            this.name = car.name;
           // this.desc = car.desc;
        }

        public Vehicle(contact plane) {
       //     this.id = plane.Id;
            this.name1 = plane.title;
            //this.desc = plane.desc;
        }
    }
}


VF page code 


<apex:page controller="YourController" >
<apex:form >
<apex:pageBlock ><apex:pageBlockTable value="{!vehicles}" var="vehicle">
   <!--- <apex:column headerValue="Id" value="{!vehicle.id}" />  --->
    <apex:column headerValue="FirstName" value="{!vehicle.name}" />
    <apex:column headerValue="Name" value="{!vehicle.name1}" />
    
    <apex:pageBlockSection title="Vitality Check Attributes">
        <apex:pageBlock >
            <apex:repeat value="{!Attributes}" var="att">
            </apex:repeat>
        </apex:pageBlock>
    </apex:pageBlockSection>
    
    
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>



 
I have a requirement where I have to display mutliple columns from different objects on a single VF page

i'm trying to display but the way its binding is improper.

public class YourController {

    public String GetAttributes { get; set; }
public List<Vehicle> vehicles { get; set; }

    public YourController() {

        vehicles = new List<Vehicle>();

        List<account> cars = [SELECT Id, Name, Description FROM account];
        
        List<contact> planes = [SELECT Id, name , Title FROM contact];

        for(account car : cars) {
        system.debug('car value in the loop ---> '+car.name);
            vehicles.add(new Vehicle(car));
        }

        for(contact plane : planes) {
        system.debug('Plane value in the loop ---> '+plane.title);
            vehicles.add(new Vehicle(plane));
        }
        
    }
    
    
      public List<contact> GetAttributes(){
    List<contact> attr = [SELECT Name from contact limit 10];
    return attr;
    }
    

    public class Vehicle {
        public Id id { get; set; }
        public string name { get; set; }
        public string name1{ get; set; }

        public Vehicle(account car) {
     //       this.id = car.Id;
            this.name = car.name;
           // this.desc = car.desc;
        }

        public Vehicle(contact plane) {
       //     this.id = plane.Id;
            this.name1 = plane.title;
            //this.desc = plane.desc;
        }
    }
}


VF page code 


<apex:page controller="YourController" >
<apex:form >
<apex:pageBlock ><apex:pageBlockTable value="{!vehicles}" var="vehicle">
   <!--- <apex:column headerValue="Id" value="{!vehicle.id}" />  --->
    <apex:column headerValue="FirstName" value="{!vehicle.name}" />
    <apex:column headerValue="Name" value="{!vehicle.name1}" />
    
    <apex:pageBlockSection title="Vitality Check Attributes">
        <apex:pageBlock >
            <apex:repeat value="{!Attributes}" var="att">
            </apex:repeat>
        </apex:pageBlock>
    </apex:pageBlockSection>
    
    
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>



 

Hi folks,

How to set up scope in batch apex?

What is the best way to do that Any examples with code appreciated.

 

Thanks in advance.

  • September 12, 2012
  • Like
  • 0