+ Start a Discussion
raysfdc1988raysfdc1988 

multiple table for single object

<apex:page controller="wrapper_controller" showHeader="false">

   
        <apex:iframe src="https://cs6.salesforce.com/01ZN0000000I2b9"  title="graphj"/>
    <apex:form >
    
    <br/>
          <br/>
          <br/>
    <apex:commandButton value="To Sell"/>
    
        <apex:pageblock >
         <apex:pageblocktable value="{!inventorywrapperret}" var="p">
          <apex:column value="{!p.object_inventory.name}" />
          <apex:column value="{!p.object_inventory.Product__c}"/>
          <apex:column value="{!p.object_inventory.Expected_Date_of_Delivery__c}"/>
          <apex:column value="{!p.object_inventory.Discount_Percentage__c}"/>
          <apex:column value="{!p.object_inventory.Quantity__c}"/>
          
          </apex:pageblocktable>
          
          <br/>
          <br/>
          <br/>
  
          
          <apex:commandButton value="To Avoid"/>

       //////different table of same oject//////////////
  <apex:pageblocktable value="{!inventorywrapperret}" var="p">
                   <apex:column value="{!p.object_inventory.name}" />
          <apex:column value="{!p.object_inventory.Product__c}"/>
          <apex:column value="{!p.object_inventory.Expected_time_Delivery_Month__c}"/>
          
          <apex:column value="{!p.object_inventory.Discount_Percentage__c}"/>
          <apex:column value="{!p.object_inventory.Quantity__c}"/>
          
          </apex:pageblocktable>


                  <apex:commandButton value="Purchase Orders"/>
          <apex:pageblocktable value="{!purchasewrapperret}" var="con">
          <apex:column value="{!con.object_purchase.name}" />
          <apex:column value="{!con.object_purchase.Product__c}"/>
           <apex:column value="{!con.object_purchase.Buyerp__c}"/>
            <apex:column value="{!con.object_purchase.Quantity__c}"/>
            <apex:column value="{!con.object_purchase.Order_Amount__c}"/>
            <apex:column value="{!con.object_purchase.Discount_Amount__c}"/>
            <apex:column value="{!con.object_purchase.Received_Amount__c}"/>
            <apex:column value="{!con.object_purchase.Open_Amount__c}"/>
            
             <apex:column value="{!con.object_purchase.Order_Status__c}"/>
          </apex:pageblocktable>
        
          </apex:pageblock>
          
           
        
    </apex:form>
</apex:page>
public with sharing class wrapper_controller {

public list<wrapperclass> wrapperelement_for_inventory{get;set;}
public list<wrapperclass> wrapperelement_for_purchase{get;set;}
public list<wrapperclass> wrapperelement_for_avoid{get;set;}

//list<Inventory_Management__c> object1 = [select id,name,Product__c,Expected_Date_of_Delivery__c,Quantity__c,Discount_Percentage__c,Expected_time_Delivery_Month__c from Inventory_Management__c  limit 10];

list<Purchase_Order__c> object2 = [select id,name ,Buyerp__c,Discount_Amount__c,Open_Amount__c,Order_Amount__c,Order_Status__c,
            Price_Book__c,Product__c,Quantity__c,Received_Amount__c,Supplier__c,Warehouse__c from Purchase_Order__c limit 10];




public list<wrapperclass> getinventorywrapperret(){
    
    wrapperelement_for_inventory= new list<wrapperclass>();
   
    for(Inventory_Management__c obj1: [select id,name,Product__c,Expected_Date_of_Delivery__c,Quantity__c,Discount_Percentage__c,Expected_time_Delivery_Month__c from Inventory_Management__c where Expected_Date_of_Delivery__c<6  limit 10])
    {
    if(obj1.Expected_Date_of_Delivery__c<10){
    
    wrapperelement_for_inventory.add(new wrapperclass(obj1));
    }
    
    return wrapperelement_for_inventory;
    }

//////////Here i want create a another table wrapperelement_for_avoid which holds the values //////////////   if(obj1.Expected_Date_of_Delivery__c>10)




public list<wrapperclass> getpurchasewrapperret(){
    wrapperelement_for_purchase= new list<wrapperclass>();
    for(Purchase_Order__c obj2: object2){
    wrapperelement_for_purchase.add(new wrapperclass(obj2));
    }
    return wrapperelement_for_purchase;
    }


public class wrapperclass{
    public Inventory_Management__c object_inventory{get;set;}
    public Purchase_Order__c object_purchase{get;set;}

    public wrapperclass(Inventory_Management__c obj1){
    this.object_inventory = (obj1);
    this.object_inventory.Product__c =(obj1.Product__c);
    this.object_inventory.Expected_Date_of_Delivery__c= (obj1.Expected_Date_of_Delivery__c);
    this.object_inventory.Expected_time_Delivery_Month__c =(obj1.Expected_time_Delivery_Month__c );
    this.object_inventory.Quantity__c=(obj1.Quantity__c);
    this.object_inventory.Discount_Percentage__c=(obj1.Discount_Percentage__c);
    }

    public wrapperclass(Purchase_Order__c obj2){
        this.object_purchase = (obj2);
        this.object_purchase.Product__c = (obj2.Product__c);
        this.object_purchase.Buyerp__c= (obj2.Buyerp__c);
        this.object_purchase.Quantity__c= (obj2.Quantity__c);
        this.object_purchase.Order_Amount__c= (obj2.Order_Amount__c);
        this.object_purchase.Discount_Amount__c= (obj2.Discount_Amount__c);
        this.object_purchase.Received_Amount__c= (obj2.Received_Amount__c);
        //this.object_purchase.Open_Amount__c= (obj2.Open_Amount__c);

        }
    }
}

Here i want ceate another table of object Inventory_Management__c with different conditon....How to call that in visualforce page...Pl help
James LoghryJames Loghry
Most elements in Visualforce have a "rendered" attribute, including apex:pageBlock table (http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockTable.htm) and apex:column (http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_column.htm (http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_column.htm)).  The rendered attribute takes a boolean condition or boolean variable and determines whether or not that particular element is rendered, e.g.: rendered="{!IF(myList.empty,false,true)}" will render an element if the list is not empty.  This is probably the easiest way to show two different pageblock tables based on different criteria in the same Visualforce page.
James LoghryJames Loghry
Sorry, the formatting goofed on my last post.