S-Docs Display record for unrelated objects
You can display a record for objects that do not have a direct relation with each other. For example, you want to display Quote Charge Tier records with a Quote Charge summary in a PDF, as shown in the following table.
The two fields are not directly related. A parent-child structure needs to be created to display this information in the PDF.
To create the relationship table, perform the following steps:
- Create a child component with the Template Format as Component. See Create Templates in S-Docs.
The template name mentioned in this template creation process would be used in the parent template. - Click the Template Editor button and paste the following code for the child component:
<!--RENDER='{{!prefix2.rownum}}'== '0' --> <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"><!-- ENDRENDER--> <tbody> <tr> <td style="font-size: 14px;text-align: center;padding: 2px 2px;white-space: normal;word-wrap:break-word;font-weight: normal;">{{!prefix2.zqci15__ProductRatePlanCharge__r.Name}}</td> <td style="font-size: 14px;text-align: center;white-space: normal;word-wrap:break-word;font-weight: normal;"> <table border="1" cellpadding="0" cellspacing="0" style="width: 100%;border-collapse: collapse;"> <tbody><!--{{!<lineitemsSOQL> <class>table439</class> <soql>select id,zqci15__StartingUnit__c,zqci15__EndingUnit__c,zqci15__Price__c from zqci15__QuoteCharge_Tier__c where zqci15__QuoteRatePlanCharge__c = '{{!prefix2.zqci15__QuoteRatePlanCharge__c}}'</soql> <column header="From" format- number="#,###.##" nullprefix="N/A">zqci15__StartingUnit__c</column> <column header="To" format- number="#,###.##" nullprefix="N/A">zqci15__EndingUnit__c</column> <column header="Price" format- number="#,###.##" nullprefix="N/A">zqci15__Price__c</column> </lineitemsSOQL>}}--> </tbody> </table> </td> <td style="font-size: 14px;text-align: center;padding: 2px 2px;white-space: normal;word-wrap:break-word;font-weight: normal;">{{!prefix2.zqci15__Quantity__c}}</td> <td style="font-size: 14px;text-align: center;padding: 2px 2px;white-space: normal;word-wrap:break-word;font-weight: normal;">{{!prefix2.zqci15__EffectivePrice__c}}</td> <td style="font-size: 14px;text-align: center;padding: 2px 2px;white-space: normal;word-wrap:break-word;font-weight: normal;">{{!prefix2.zqci15__TotalPrice__c}}</td> <td style="font-size: 14px;text-align: center;padding: 2px 2px;white-space: normal;word-wrap:break-word;font-weight: normal;">{{!prefix2.zqci15__Period__c}}</td> </tr> </tbody> <!--RENDER='{{!prefix2.rownum}}'== '0' --> </table> <!--ENDRENDER-->
- Create a parent component.
- Click the Template Editor button and paste the following code for the parent component:
<style type="text/css">table.table439 {border-collapse: collapse; font-size: 14px; font-family:Arial Unicode MS,sans-serif; width:100% ;border: 1px solid #C1CED9; } .table439header {font-size: 14px;text-align: center;padding: 5px 5px;white-space: normal;word-wrap:break-word;font-weight: normal;background: #F5F5F5; } </style> <table border="1" cellpadding="0" cellspacing="0" class="table439"> <tbody> <tr> <td class="table439header">Rate Plan Name</td> <td class="table439header">Tier Details</td> <td class="table439header">Quantity</td> <td class="table439header">Effective Price</td> <td class="table439header">Total Price</td> <td class="table439header">Period</td> </tr> </tbody> <!--{{! <LineItemsSOQL> <class></class> <ListName>zqu__QuoteChargeSummary__c</ListName> <soql>select id,zqci15__QuoteRatePlanCharge__c,zqci15__ProductRatePlanCharge__r.Name,zqci 15__Quantity__c, zqci15__EffectivePrice__c,zqci15__TotalPrice__c, zqci15__Period__c from zqci15__QuoteChargeSummary__c where zqci15__QuoteRatePlan__r.zqci15__Quote__c = '{{!ObjectID15}}' and zqci15__ChangeLog__c != null</soql> <column componentMergeField="true">rownum</column> <column componentMergeField="true">zqci15__QuoteRatePlanCharge__c</column> <column componentMergeField="true">zqci15__ProductRatePlanCharge__r.Name</column> <column componentMergeField="true">zqci15__Quantity__c</column> <column componentMergeField="true" format- number="#,###.##">zqci15__EffectivePrice__c</column> <column componentMergeField="true" format- number="#,###.##">zqci15__TotalPrice__c</column> <column componentMergeField="true">zqci15__Period__c</column> <component columnFields="true" mergeFieldPrefix="prefix2">Child Charge Summary</component> </LineItemsSOQL> }}--> </table>