Question

I'm trying to create a crosstab in Crystal Reports, integrated with the Visual Studio environment. The problem is that I need to use the total value of the crosstab (here I mean the Line Total) to do some other calculations in the report.

I know a bit of Crystal Reports, but never did something similar. Searches on google resulted in nonsense answers or overly complicated solutions to solve the problem, or solutions that were not exactly my problem.

Is there a relatively simple way to do this? I just need to get the total value of the crosstab and put in a variable, that's all.

Thanks in advance.

Was it helpful?

Solution

Honestly, I didn't think this was possible, but I found a way:

  • In Preview mode, select the desired field (I used the grand total row/column).
  • Right click the field, choose 'Format Field..., select the 'Common' tab, then click the conditional-formula button adjacent to the 'Display String' property.
  • Enter the following text

:

// change to desired type
Shared Currencyvar amount := CurrentFieldValue;
// change formatting to match desired value
ToText(amount)
  • Create a formula {@amount}; enter the following text:

:

// change data type to match
Shared Currencyvar amount;
  • Place this field in a section that follows the section that contains the cross-tab
  • Insert a sub-report in the same section as the one that contains the cross-tab (you don't need to include any tables)
  • Create a formula field {@amount}; enter the following text:

:

// change data type to match
Shared Currencyvar amount;

The final result will resemble:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top