Sunday, 9 July 2017

Program to display array of records in page block table

Program to display array of records in page block table 

Write a program to display array of string in page block Table 

Ans:  Public class array example {
          public string [] my Val {set; get;}
          public string name {get; set;}
          public Array example () 

                   { 
                     Name = ‘Prasad’; 
                    My val = new string [] {‘Sam’, ’ram’, ’Karan’};
                     }
               }
<apex:  page controllers =” Array Examples”>
<apex: from> 
<apex: page block >
<apex: page block table=” {! my Val}” vary =” a”>
<apex: column value e=” {! a}”/>
</apex: page block table>
<apex: output label> {! name} </apex: output label>
<apex: page block>
</apex: from>
</apex: page>

write a program to display array of account records.

 Ex: -
            Public class Array Example {
             Public account [] my value {set; get;}
            Public Array Example(.)
                        {
           Account a1= new account (name= ’sushi’  , Industry=’Banking’);
           Account a2= new account (name=’Ravi’ , Industry=’Banking’);
Account a3= new account (name=’Praveen’, Industry=’Banking’);
 My value=new account [] {a1, a2, a3};
         }
   }

<apex: page controllers =” Array Example”>
<apex: from>
<apex: page block>
<apex: page block table value=” {! my Val}” vary=” a”>
<apex: column value =” {! a. name}”/>
<apex: column value=” {! a. industry}”/>
<apex: page block table>
<apex: output label> {! name} </apex: output label>
</apex: page block>
</apex: from>
</apex: page>

No comments:

Post a Comment