When designing dynamic reports using FlexReport (or legacy C1Report), you may need to hide or display specific text fields or entire report sections based on parameter values passed at runtime—for instance, suppressing a details subsection or hiding sensitive fields when a parameter matches a specific criteria.
Solution
You can control the visibility of individual fields or entire sections dynamically by writing VBScript in the report's Detail.OnFormat event handler (or the OnFormat event of the specific section you want to evaluate).
In the report's script editor, evaluate your parameter or field value using standard If...Else...EndIf statements, and assign True or False to the Visible property of the target field or section object.
' Example 1: Conditionally hide a specific text field
If ParameterName = "SpecificValue" Then
Field4.Visible = False
Else
Field4.Visible = True
EndIf
' Example 2: Conditionally hide an entire report section (e.g., Detail section)
If ParameterName = "HideDetailSection" Then
Detail.Visible = False
Else
Detail.Visible = True
EndIf