Page 1 of 1

What is the equivalent to Crystal shared variables?

Posted: Sat Dec 01, 2018 3:51 pm
by TestBoy
So in Crystal when we want a variable we use one in a formula, whack that into say, a report header as "shared foo whatever" and so on.
Then we assign values, usually in a details section like foo := 8;
We do a lot of reports where the actual data being printed is done so in the group footers so lists is compiled on the fly in the report itself.
What is the equivalent here?

Re: What is the equivalent to Crystal shared variables?

Posted: Sun Dec 02, 2018 6:35 am
by HighAley
Hello.

There are variables of the report that you could use.
You could set a value of the variable with next code:

Code: Select all

report.Dictionary.Variables["Variable1"].Value = yourCancatenatedString;
Thank you.

Re: What is the equivalent to Crystal shared variables?

Posted: Sun Dec 02, 2018 5:09 pm
by TestBoy
I know i can set it from the code end of things but I need to do this inside of the report itself.
Doing it in code would work but I would need to hit the database twice, once just to get these values and again to actually run the report.
That's a nasty hack at best.

Certainly there is a way to save these values as it's printing them in the detail section as you can with Crystal?

Re: What is the equivalent to Crystal shared variables?

Posted: Mon Dec 03, 2018 8:15 am
by Lech Kulikowski
Hello,

Also, you can set value for the variable in the Text expression:
{Variable1 = DataSourceName.ColumnName}
or in reports events.

Thank you.

Re: What is the equivalent to Crystal shared variables?

Posted: Mon Dec 03, 2018 2:38 pm
by TestBoy
Ok, shame on me for not noticing that each of these bands had events that I could wire into.
My solution was to clear the variable in the group header's begin render and then add my values to it in the rendering event of the data band.

Re: What is the equivalent to Crystal shared variables?

Posted: Tue Dec 04, 2018 2:14 pm
by Lech Kulikowski
Hello

Ok.
Please let us know if you need any additional help.

Thank you.