Hello. I am creating a solution similar to the product catalog demo, only I have several detail regions for a given master region. My requirement is to hide any detail table if there is no data returned for that given detail. I am easily able to remove a table using a conditional statement with a known table index such as:
DataTable dt = //go get data
if (dt.Rows.Count == 0) doc.Sections[0].Body.Tables[2].Remove();
else doc.MailMerge.ExecuteWithRegions(dt);
However, the template for this solution will be modified by the end customer, and the order of the tables may change (or a table may be deleted entirely). Is there a way to programmitically determine which table I need to remove so that I don’t have to hardcode the index in there?
Thank you in advance for your help.
ETA: can I access the table by searching for the TableStart: merge field? If so, how would I do that?