Skip to main content

How to use variable values from a subreport in calculations with data from main report?

  • December 7, 2020
  • 1 reply
  • 896 views

Haven’t had any luck finding more detailed instructions on being able use variables from a sub report in calculations back on the main report.  I know you have to be able to do this and I can do it easily in Crystal reports.  There are a few lines ive found in the help about using the subreport name in variable name to retrieve it but hasnt worked.  If anyone has some samples to show that would be great, thank you!

 

 

1 reply

wfilipiak67
Captain II
Forum|alt.badge.img+3
  • Captain II
  • December 15, 2020

Mike, 

What I found was that I had to convert the variable to a number using the CDec Function.
Here is an example, from a live system, were the $subReport_PayTotal is passed from the subreport

We multiply by -1 if the type is a credit memo.

=IIF ( [SOOrder.OrderType]<>'CM',( CDec([SOOrder.CuryOrderTotal]) - CDec($subReport1_PayTotal) ), (CDec([SOOrder.CuryOrderTotal]) - CDec($subReport1_PayTotal)) * -1)