Skip to main content
Conga Support

Using Detail Regions with If Statements

When using Detail Regions with IF statements it is important to consider whether your report has the possibility of returning no data, in which case your IF statement could be deleted if not set up properly.  To avoid this issue you will have to isolate your TableStart/TableEnd to a line by itself.

If all your merge fields in an IF statement are coming from detail data, enclose the entire IF statement with TableStart and TableEnd fields, but leave them outside the IF statement. That way, if your report returns no data, it does not break the IF statement. You must use traditional merge fields (not text-based fields). 

Nested IF statements, where the else value is another conditional IF statements, work  with Conga Composer. Conga does not support nested IF statements in Microsoft Word. The recommended alternative to nested IF statements in Microsoft Word is to use the native IF and CASE Logical Functions in Salesforce formulas.  

For more information, see the article called Conditionally Remove a Row in a Table that Has no Data. 

The examples below are toggled open. 

{MERGEFIELD TableStart:Case \* MERGEFORMAT }

{IF "<<CASE_STATUS>>"="Closed" "<<Close_Date>>" "Open" \ * MERGEFORMAT }

{MERGEFIELD TableEnd:Case \* MERGEFORMAT }

If only one of the Fields in an IF statement is being populated by detail data, you'll want to enclose ONLY that field in TableStart/TableEnd fields, and make sure this field has its own line.

{ IF "<<OPPORTUNITY_CLOSEDATE>>" = "<<TODAY>>"

<<TableStart:Case>> "<<Close_Date>>" <<TableEnd:Case>>

"Open" \ *MERGEFORMAT }

Maybe you have two different detail datasets you want to compare in one IF statement. The process for this is simply an extension of the above technique, where each dataset needs its own row.

{ IF "<<OPPORTUNITY_CLOSEDATE>>"="<<TODAY>>"

"<<TableStart:Case>> <<Close_Date>> <<TableEnd:Case>>"

"<<TableStart:Opportunities>> <<Close_Date>> <<TableEnd: Opportuntities>>"

" \* MERGEFORMAT }