Friday 21 April 2017

Display/ Passing Subreport Value into Main Report in Crystal Report

When using a sub report, you may wish to pass a result (such as a computed field, summary, or running total) back to the main report. A shared variable can be used to do this as long as you understand the order in which the results are calculated.
To use a subreport value in the main report, you must calculate it first - that is, the subreport must appear "above" its use in the main report. If this does not work with your report structure, you may have to put an extra copy of your subreport in a higher section.
For example, place this in the main report header section:
Computed item:
 whileprintingrecords;
 Shared NumberVar x := 0;
Subreport:
 whileprintingrecords;
 Shared Numbervar x:= sum({yourtable.yourcolumn})
Color each of these items with white text and shrink to the smallest size possible. Do not use the "suppress" option, as this prevents the item from being calculated.

No comments:

Post a Comment

Control Structures (Crystal Syntax) In Crystal Report : If Expressions (Crystal Syntax) in Crystal Report

Formulas without control structures execute each expression in the formula exactly once when the formula is evaluated. The expressions are...