Using Crystal Reports Fields/Functions in CRChart Macros

You can use any field or function in Crystal Reports as a parameter for a CRChart Macro.

For Numeric Parameters:

IMPORTANT NOTES:

EXAMPLE:

In the Data tab of the Chart Expert dialog, the "Sum of Table1.ErrBarLo" and "Sum of Table1.ErrBarHi" fields are added at zero-based positions 3 and 4 in the "Show value(s) list.

The @CY macro requires four numeric parameters identifying the location and color of a line to draw on the Y-Axis:

@CY fYValue nRed nGreen nBlue

In this example, the value of P3 (Sum of Table1.ErrBarLo) and P4 (Sum of Table1.ErrBarHi) are used as input parameters to identify the location of the lines:

@CY P3 255 0 0
@CY P4 0 255 0

The first @CY macro draws a red (255 0 0) line on the Y-Axis at value P3. The second @CY macro draws a green (0 255 0) line on the Y-Axis at value P4:

For String Parameters:

Legend labels that contain string~ prefixes can be extracted and used in CRChart macros that use numeric input parameters. Legend labels must be formatted with each prefix string terminated with a tilde (~) and a space:

String0~ String1~ ... Stringn~ Legend Label

Prefix strings must be numeric characters (0...9). Use the letter "S" and the zero-based position of the prefix string (e.g., S0, S1, S2, etc.) as an input parameter to any macro that requires a numeric (integer or real) value. When an Sn parameter is used as an input parameter to a CRChart macro, the prefix is stripped from the legend label and will not be shown in the legend area.

IMPORTANT NOTES:

EXAMPLE:

The legend label strings contain the following prefixes:

1~ 2008~ 24~ TOYS
1~ 2008~ 24~ TOOLS
1~ 2008~ 24~ TENTS

The @X_AXIS_MODE2 macro requires three numeric parameters that identify the start month, start year, and number of elements to cast X-Axis labels into day/month/year strings:

@X_AXIS_MODE2 nStartMonth nStartYear nElements

Value string prefixes from the legend labels are used as the input parameters to this macro:

@X_AXIS_MODE2 S0 S1 S2

In this example, S0 (1) is used for the macro's nStartMonth parameter, S1 (2008) is used for the nStartYear parameter, and S2 (24) is used for the nElements parameter.

This macro creates X-Axis label strings beginning at nStartMonth S0 (1) and nStartYear S1 (2008) for nStartElements S2 (24). Note that the label prefix strings (1~ 2008~ 24~) are not included in the legend labels. They have been stripped out for use in the @X_AXIS_MODE2 macro.

 

 

 

 

CRChart is a product from
Three D Graphics, Inc.
Los Angeles, CA 90064 (threedgraphics.com)