Skip to Content
Aug 05 at 08:32 PM

SubReport: Dynamic Build Record Selecton Formula based upon the values of the sub report links

89 Views Last edit Aug 05 at 09:12 PM 2 rev

I have a Crystal Report with a sub report.

The sub report has the same where clause as the main report. but shows some additional data based upon system configuration. I went this way because I don't want to maintain two report files.based upon how a system is configured. I rather just show a sub report when necessary. (its DRY: Don't Repeat Yourself)

The where clause for the main report is built at at runtime based upon what inputs the user has given and the application uses the crystal report SDK to set the RecordSelectionFormula on the report document object.

I'd like to give the sub report this same where clause. The Report Selection Formula builder needs to see a boolean clause. Passing in the predefined RecordSelection in the from main report to the sub report won't work as I get the warning the "Record Selection Formula Editor needs to see a boolean. "

See how the application can set the RecordSelectionFormula on the main report, I suppose I can pass the where clause to the sub report but just curious, can the Crystal Report Record Selection Formula builder do the following

VIEWNAME.Field = {input}

if (input 2 = 1) then

AND VIEWNAME.FieldTwo > ("some text")

if (input3 = A) then

AND VIEWNAME.FieldThree > ( a number)