Formatting Related List Subquery Rows

Format Subquery Rows with CSS or Custom Code Tags

Subquery rows will automatically appear on rows below any of their parent query results. However, it is recommended to use the column attribute newrow="true" on the first subquery column in order to ensure specific column formatting and styling.

Specify Color on Even/Odd Rows in a Subquery

Row Coloration Syntax

S-Docs offers support to specify coloration on even and odd rows in subquery records.

The syntax, which is tableXXXsubRowEven and tableXXXsubRowOdd, is case-sensitive, and if not specified, will revert to the CSS that's specified by tableXXXRowEven and tableXXXRowOdd.

Coloration in LineItemsSOQL can be specified by <rowcoloration>tablerow</rowcoloration> and <rowcoloration>record</rowcoloration>.

If <rowcoloration>tablerow</rowcoloration> is specified, the table row class is changed from tableXXXRowOdd to tableXXXRowEven (and vice versa) every time a new table row (<tr>) is insertedThis is also true for table rows inserted by newrow="true"groupbysum, etc.

Example Table & Code

In this case, the table would look something like the following, given the sample code below:

<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><strong>&lt;rowcoloration&gt;record&lt;/rowcoloration&gt; w</strong></span></span><strong>ith newrow="true" </strong></span></span>
<ul>
<li><span style="color:#000000;"><span style="font-family:arial,helvetica,sans-serif;"><em>Row colors change every other record.</em></span></span></li>
<li><span style="color:#000000;"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><em>The body of each chatter post/comment record is inserted in a new row after the the record\'s other columns.</em></span></span></span></li>
</ul>
<br />
<!-- ******************** START RELATED LIST SECTION UNIQUEID:876********************-->
<style type="text/css">table.table876 {border:solid black 1px; border-collapse:collapse; border-spacing:0px;font-family:Arial,Helvetica,sans-serif; font-size:10pt; width:100% }
.table876header {text-align:center;border:solid black 1px;color:#FFFFFF;background-color:#000000;}
.table876footer {text-align:right;font-weight:bold;border:solid black 1px; height: 30px}
.table876subheader {text-align:center;font-weight:bold;border:solid black 1px;color:#FFFFFF;background-color:#000000;}
.table876RowEven{border:solid black 1px;background-color:#2ecc71;}
.table876RowOdd{background-color:#cdcdcd;border:solid black 1px;}
.table876subRowEven{border:solid black 1px;background-color:#f1c40f;}
.table876subRowOdd{background-color:#8e44ad;border:solid black 1px;}
.table876col0{border:solid black 1px;text-align:left;}
.table876col1{border:solid black 1px;text-align:left;}
.table876col2{border:solid black 1px;text-align:left;} 
.table876col3{border:solid black 1px;text-align:left;}
.table876col4{border:solid black 1px;text-align:left;} 
.table876col5{border:solid black 1px;text-align:left;}
</style>
<table class="table876">
<tbody><!--{{!
<lineitemsSOQL><class>table876</class>
<listname>feeds</listname>
<soql>
SELECT createdby.name, Body, createdby.phone,
(SELECT createdby.name, createdby.phone,CommentBody FROM FeedComments)
FROM FeedItem WHERE ParentId = '{{!ObjectID15}}'
ORDER BY createddate desc</soql>
<column header="Created By Name">createdby.name</column>
<column header="Created By Phone">createdby.phone</column>
<column newrow="true" colspan="2" type="text">body</column>
<column header="(Subquery Header) Created By Name" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.name</column>
<column header="(Subquery Header) Created By Phone" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.phone</column>
<column newrow="true" colspan="2" type="text">sub.FeedComments.CommentBody</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<span style="font-family:arial,helvetica,sans-serif;"> </span><!-- ******************** END RELATED LIST SECTION UNIQUEID:876********************-->

<div style="page-break-after: always"><span style="display: none;">&nbsp;</span></div>
<span style="color:#FF0000;"> </span><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"> </span><strong><span style="color:#FF0000;"></span></strong><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><strong>&lt;rowcoloration&gt;record&lt;/rowcoloration&gt; w</strong></span></span><strong><span style="color:#FF0000;">ithout newrow="true" </span></strong></span>

<ul>
<li><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><em>Row colors change every other record. </em></span></span></li>
<li><span style="font-family:arial,helvetica,sans-serif;"><em>The body of each chatter post/comment record is inserted in the same row as the the record's other columns.</em></span></li>
</ul>
<br />
<!-- ******************** START RELATED LIST SECTION UNIQUEID:876********************-->
<table class="table876">
<tbody><!--{{!
<lineitemsSOQL><class>table876</class>
<listname>feeds</listname>
<soql>
SELECT createdby.name, Body, createdby.phone,
(SELECT createdby.name, createdby.phone,CommentBody FROM FeedComments)
FROM FeedItem WHERE ParentId = '{{!ObjectID15}}'
ORDER BY createddate desc</soql>
<column header="Created By Name">createdby.name</column>
<column header="Created By Phone">createdby.phone</column>
<column header="Body" type="text">body</column>
<column header="(Subquery Header) Created By Name" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.name</column>
<column header="(Subquery Header) Created By Phone" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.phone</column>
<column header="(Subquery Header) Comments" type="text">sub.FeedComments.CommentBody</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<span style="font-family:arial,helvetica,sans-serif;"> <!-- ******************** END RELATED LIST SECTION UNIQUEID:876********************--></span><br />
<br />
<style type="text/css">
</style>
<div style="page-break-after: always"><span style="display: none;">&nbsp;</span></div>
<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><strong>&lt;rowcoloration&gt;tablerow&lt;/rowcoloration&gt; w</strong></span></span></span></span><strong>ith newrow="true"</strong></span></span>
<ul>
<li><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><em>Row colors change every other table row. </em></span></span></li>
<li><span style="font-family:arial,helvetica,sans-serif;"><em>The body of each chatter post/comment record is inserted in a new row after the the record's other columns.</em></span></li>
</ul>
<br />
<!-- ******************** START RELATED LIST SECTION UNIQUEID:876********************-->
<table class="table876">
<tbody><!--{{!
<lineitemsSOQL><class>table876</class>
<listname>feeds</listname>
<rowcoloration>tablerow</rowcoloration>
<soql>
SELECT createdby.name, Body, createdby.phone,
(SELECT createdby.name, createdby.phone,CommentBody FROM FeedComments)
FROM FeedItem WHERE ParentId = '{{!ObjectID15}}'
ORDER BY createddate desc</soql>
<column header="Created By Name">createdby.name</column>
<column header="Created By Phone">createdby.phone</column>
<column newrow="true" colspan="2" type="text">body</column>
<column header="(Subquery Header) Created By Name" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.name</column>
<column header="(Subquery Header) Created By Phone" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.phone</column>
<column newrow="true" colspan="2" type="text">sub.FeedComments.CommentBody</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<span style="font-family:arial,helvetica,sans-serif;"> </span><!-- ******************** END RELATED LIST SECTION UNIQUEID:876********************-->

<div style="page-break-after: always"><span style="display: none;">&nbsp;</span></div>
<span style="color:#FF0000;"> </span><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"> </span><strong><span style="color:#FF0000;"></span></strong><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><strong>&lt;rowcoloration&gt;tablerow&lt;/rowcoloration&gt; w</strong></span></span></span></span></span><strong><span style="color:#FF0000;">ithout newrow="true"</span></strong></span>

<ul>
<li><span style="font-family:arial,helvetica,sans-serif;"></span><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-family:arial,helvetica,sans-serif;"><em>Row colors change every other table row. </em></span></span></span></li>
<li><span style="font-family:arial,helvetica,sans-serif;"><em>The body of each chatter post/comment record is inserted in the same row as the the record's other columns.</em></span></li>
</ul>
<br />
<!-- ******************** START RELATED LIST SECTION UNIQUEID:876********************-->
<table class="table876">
<tbody><!--{{!
<lineitemsSOQL><class>table876</class>
<listname>feeds</listname>
<rowcoloration>tablerow</rowcoloration>
<soql>
SELECT createdby.name, Body, createdby.phone,
(SELECT createdby.name, createdby.phone,CommentBody FROM FeedComments)
FROM FeedItem WHERE ParentId = '{{!ObjectID15}}'
ORDER BY createddate desc</soql>
<column header="Created By Name">createdby.name</column>
<column header="Created By Phone">createdby.phone</column>
<column header="Body" type="text">body</column>
<column header="(Subquery Header) Created By Name" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.name</column>
<column header="(Subquery Header) Created By Phone" prefix="(Subquery Column) " nullprefix="(Subquery Column) ">sub.FeedComments.createdby.phone</column>
<column header="(Subquery Header) Comments" type="text">sub.FeedComments.CommentBody</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
<span style="font-family:arial,helvetica,sans-serif;"> <!-- ******************** END RELATED LIST SECTION UNIQUEID:876********************--></span><br />
<br />
<style type="text/css">
</style>

If <rowcoloration>record</rowcoloration> is specified, the table row class changes from tableXXXRowEven to tableXXXRowOdd (and vice versa) upon iterating through all of the columns for the current record, regardless of how many table rows (<tr>) were inserted during that time.

If neither are specified, the default will be <rowcoloration>record</rowcoloration>.

Tags: , ,

Was this helpful?