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
Paul Miki ANDRIAMIARANTSOA 9Paul Miki ANDRIAMIARANTSOA 9 

Apex

I want to display two values ​​in two different custom object in one table , but I can not even , can someone help me please
Swagato RaySwagato Ray
hi Paul,

I think those two custom objects have relation within them. If so then you can use their relation name to display the values.
Suppose "CustomObject1" and "CustomObject2" has a relation named "CustomObject1__r". then you can use below SOQL like

select ColumnFromCustomObject1__c,CustomObject1__r.ColumnFromCustomObject2 from CustomObject1
santoshgoresantoshgore
Hi Paul,
 If there is no relationship among those object then you can create a wrapper class and use that wrapper class in your VF page.Somemwhat like below:
//declaration
public class Wrapper {
    CustomObject1 cObj1;
    CustomObject2 cObj2;

    public Wrapper() {
     }
   public Wrapper(CustomObject1 cObj1, CustomObject2 cObj2) {
         this.cObj1 = cObj1;
         this.cObj2 = cObj2;
     }
}

//adding value in warpper
List<Wrapper > lstWrapper = new List<Wrapper >();
lstWrapper.add(cObj1,cObj2);

//dispaly

<pageblocktable value="{!lstWrapper }" var = "var''>
    <apex:column value = {!var.cObj1.name}>
  <apex:column value = {!var.cObj2.name}>
</pageblocktable>

Thanks,
Santosh