You need to sign in to do that
Don't have an account?
how to display two query results in one table
hi
I have two non related objects for which i have written two queries i want to display the two query results in only one table in visual force page how can i do that both the queries will have the same item and ware house equal that is the only relation i have
Fulfillment__c f=[select id,item__c from Fulfillment__c where item__c=:userinput.item__c and warehouse__c=:userinput.warehouse__c ];
Goods_Received_Note_Line_Item__c grnli=[select id,item__c,warehouse__c from Goods_Received_Note_Line_Item__c where item__c=:userinput.item__c and warehouse__c=:userinput.warehouse__c
Hi,
if you are using a custom controller, you can simply use a wrapper class which will return object of both types.
can u give me sample code
Hello,
In a nutshell you need to 'package' both you objects into a single one - that's what the wrapper is for.
After that you'll need to create a List<Wrapper> from those 2 lists that you've retrieved on a previous step.
You'll need to expose this list from the controller to your page using {get; set;}
You're gonna iterate through this list in your page using an <apex:repeat>. Access to the 2 objects will be done through the s1 and s2 properties.
Regards,
Adrian
HI,
please take a look at the following link, it may help you
http://force-salesforce.blogspot.in/2012/07/using-wrapper-class-for-displaying.html
hi thats great help but can i sort them both by date
Yes,
you can use "order by" keyword in your query to sort them by date. for example