Full Use Case:
An invoice is going to be generated from the Opportunity object, and it will include the OpportunityLineItems, however, we’d like to show sets of opportunity line items in the invoice; something like the following:
Opportunity Name: XXX
Account Name: XXX
Products (Showing the OppLineItems that have Product01 only)
<Table with details here>
Different Products (Showing the OppLineItems that have Product02 only)
<Table with different details here>
How can I acheive this use case with RS Documents?
1) You should create a table for each product category to merge the OppLineItem related list and create a filter of that related list based on your condition. Then build a separate table to merge another related list of OppLineItem that would have a different condition.
2) If by chance you are merging invoice from a record that has no values to merge and you do not want the table or title of table to be visible then you need a conditional section around each table and some field you can use for that conditional merge section. Then you can create rollup fields on the Opportunity to provide a count for each product category. Then create a formula/checkbox field to be TRUE if the rollup field is greater than 0. And use that field as the condition for the conditional section.