Page 1 of 1

Location in report where to assign variables

Posted: Tue Feb 04, 2020 7:31 am
by Artimidor
Where is one supposed to assign a variable, so that it doesn't show up in the report but can be used later?

My initial thought was to output the value and then assign it to the variable I'd like to use later. The content of the textbox looks like this:

{Sum(ProductTotals.Amount)}
{varTotalAmount=Sum(ProductTotals.Amount)}

In preview, everything looks fine. The value is displayed and the variable now contains the value, which I can output later. But once I fill the report with actual data, two rows are being displayed instead of one. The value appears twice??

Re: Location in report where to assign variables

Posted: Tue Feb 04, 2020 6:06 pm
by HighAley
Hello.

It seems that you are using our different report engines.
If you need to get the sum anywhere else you could use the same expression.
The same sums are cached. Or you could try to use the report events to save the value.
It's better to use the GetValue event of this text component.

Thank you.

Re: Location in report where to assign variables

Posted: Wed Feb 05, 2020 10:21 am
by Artimidor
I fear, both approaches don't work.

When I move the code {varTotalAmount=Sum(ProductTotals.Amount)} into the GetValue event of the text component and preview it I get the error "Sum is not defined". varTotalAmount is still zero.

Likewise, when I try to access a sum in another data-band by simply referring to it with Sum(ProductTotals.Amount) the value is wrong. There seems to be some calculation going on (the value is not zero), but the output is wrong nevertheless,

Re: Location in report where to assign variables

Posted: Fri Feb 07, 2020 9:57 am
by HighAley
Hello,

Please, send us your report template with sample data for analysis.
Also we need to know where and how do you run the report.

Thank you.

Re: Location in report where to assign variables

Posted: Mon Mar 18, 2024 7:22 am
by eirajeremy
Hi
In order to assign a variable that doesn't show up in the report but can be used later, you can assign the value to the variable directly without outputting it first. This can help prevent the value from displaying multiple times when the report is filled with actual data. For example:

{varTotalAmount=Sum(ProductTotals.Amount)} my location

By assigning the value to the variable without outputting it, you can ensure that it is stored for later use without affecting the appearance of the report.

Re: Location in report where to assign variables

Posted: Mon Mar 18, 2024 7:56 am
by Lech Kulikowski
Hello,

Thank you for the information.