Hello @rschopper,
Thanks for reaching out, and welcome to the Docusign Community!
DocuSign Gen doesn’t have a native way to deduplicate rows; there’s no “collapse” or SELECT DISTINCT function, even with Salesforce SOQL. If Salesforce sends five records, Gen will render five rows.
You may consider trying to use a Group tag instead of TableRow. Tablerow tags will produce one row per record we find in a related list. Whereas a Group tag will attempt to group related list records by certain data, and if a tablerow table isn't found within the group tags, then the system will only grab the first record it finds, ignoring the others. In other words, while Gen can't deduplicate rows inside a standard table, it does have a grouping function. You can group the records by Brand, output the name of the Brand once per group, and simply choose not to render the individual records inside that group.
Instead of using <TableRow ...>, you would wrap a one-row table in Group tags, grouping by their Brand field.
<# <Group Select="/Parent_Object__c//Child_Records__r" By="./Brand__c" /> #>
[ <# <Content Select="./GroupName" /> #> ] <-- Imagine this is a 1-row Word table with that Content tag in the singular table row.
<# <EndGroup/> #>
The <Group> tag identifies all unique Brands. The <Content Select="./GroupName" /> tag outputs the unique value (the Brand) that the group is based on. By deliberately leaving out the <TableRow Select="./GroupItems/Item" /> tag, the duplicate child records are completely ignored.
The <Group> tag is designed to repeat entire blocks of text or whole tables, not individual rows within a static table. If you put a one-row table inside a <Group> tag, Gen generates a new, separate one-row table for every Brand. If you format the Word document perfectly with zero paragraph spaces between the tags, Microsoft Word will usually "snap" and merge these individual tables together into what looks like one contiguous table. However, it can be very finicky to set up and format correctly.
I hope this helps. If you believe this response effectively addresses your question, please mark it as “Best Answer” to help other users with similar questions locate it more easily. Should you require any additional assistance, feel free to reach out. Thank you!
Best Regards,
Jenny | Docusign Community Moderator
If this helped, feel free to click "Best Answer"!