Skip to Content
Technical Articles
Author's profile photo Jamie Wiseman

Charting off of Any Number in Crystal Reports

You may have a Crystal Report that has a WhilePrintingRecords formula. It is not possible in Crystal Reports 2008 and below to create a chart directly off of that formula due to evaluation times. Don’t despair though, as here’s a way to chart off of these values.


This blog post and sample report will show you how to chart off of the values you have in any WhilePrintingRecords formula.


  1. In this sample, shared variables created on a details level subreport are to be graphed on.
  2. Group values (in this case Customer names) are rolled up into a string running total that is character separated.
  3. Values that are to be graphed on are rolled up into another string running total which is also character separated.
  4. A subreport is created and then linked on the two above-mentioned formulae.
  5. The subreport parses out the values in the Value RT running total to create the graph.
  6. The Group RT formula can be used in the subreport’s record selection formula to limit the number of records that will be shown in the graph and hence the number of records returned in the subreport.


Below is a screenshot from the sample report.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      This is great. There is so many uses for this, but I have a question about your "Formula" Operator. What does it do, and how did you get it to be an Operator?
      Author's profile photo Jamie Wiseman
      Jamie Wiseman
      Blog Post Author
      good question...the operator "^" is only used as a separator for the 'string running total' could use any symbol as the separator as long as you are sure that it won't be in the data that you wish to use...i didn't use a comma due to that reason.

      all of the data that is needed in the chart is rolled up into the string running total and each value is separated by the "^" symbol. the string running totals are passed to a subreport, via a subreport link, and a "split" function is used to parse out the values both in the record selection formula and in a formula which is used in the chart Show Values.

      Author's profile photo Former Member
      Former Member
      What I am refering to is that in your formulas you use an Operator that is called Formula. It is not a standard Operator.  What does it do, and how did you create it (what do you have to do to make it show up in the Operators section of the Formula Editor)?

      Example from one of your formulas:

      shared grouprt as string
      grouprt = grouprt + {Customer.Customer Name} + "^"
      if onlastrecord then formula = "^" + grouprt else formula = grouprt

      Author's profile photo Jamie Wiseman
      Jamie Wiseman
      Blog Post Author
      my apologies...i see what you mean. "formula" is used in crystal's "basic" syntax which differs from the regular crystal formula syntax.

      in regular crystal syntax the formula result is always the last bit of code in the formula. however, in crystal basic syntax, the formula operator designates what will actually be the formula result regardless of what is at the bottom of the formula.

      this can be an advantage in basic syntax as you can assign different values to a variable after that variable has been printed / made available to other formulae.

      Author's profile photo Former Member
      Former Member

      It seems it would solve all my current problem. However, I still dont understand How you parse the the string separated by "^". How to you give it to the chart and how do you split it on "^"

      If I create a variable making the split, it return an array (which is not allowed as an error message is coming)