Skip to content

In a Crystal Report Rule condition/formula, is there a way to run a small SQL lookup and use its result (e.g. checking whether the current user belongs to a specific department) as part of the rule's TRUE/FALSE logic?

Answer

Yes — Report Rule expressions support an inline SQL-lookup syntax like [&SELECT something FROM somewhere WHERE somefield='[#IFSVariable]'], where [#IFSVariable] is substituted with a runtime IFS value (such as the current user). If the embedded query returns a row, the expression evaluates as TRUE, which lets you drive report-routing/selection logic off a live database lookup keyed to the current session rather than only off static field values on the report's own record.

← Browse Reporting and analytics questions