<apex:pageBlockTable value="{!oldSubscriptionAndAsset}" var="assetAndSubs">
<apex:column>
<apex:facet name="header">Asset</apex:facet>
<apex:outputText value="{!assetAndSubs.SBQQ__Asset__r.Name}"/>
</apex:column>
<apex:column>
<apex:facet name="header">Asset</apex:facet>
<apex:outputText value="{!assetAndSubs.SBQQ__Product__r.Name}"/>
</apex:column>
</apex:pageBlockTable>
oldSubscriptionAndAsset =[SELECT Id, SBQQ__Product__r.Name, SBQQ__Quantity__c,(SELECT Id, SBQQ__Asset__r.Name, SBQQ__Asset__r.SerialNumber, SBQQ__Asset__r.Is_Selected_For_Renewal__c FROM SBQQ__SubscribedAssets__r) FROM SBQQ__Subscription__c];
I have a master detail relationship, Subscription(Master) and SubscribedAsset(Child), in my visualforce page, I want to show in different column the subscription name (master), name of the asset in lookup field Asset__c in SubscribedAsset(child record). So that, every subscription has many asset. My problem is, how could I reference the lookup fields of child records on different column? what will be the exact 'value' for the output text?
SBQQ__Subscription__c
, each record within which has detail objects withinSBQQ__SubscribedAssets__r
, and what you want is to reference a field on one of the detail objects. If that is correct, you need a nested iteration - or possible aLIMIT 1
on your query; it's not clear what you are trying to achieve.