What is the equivalent to Crystal shared variables?

Stimulsoft Reports.WPF discussion
Post Reply
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

What is the equivalent to Crystal shared variables?

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: What is the equivalent to Crystal shared variables?

Post 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.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: What is the equivalent to Crystal shared variables?

Post 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?
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: What is the equivalent to Crystal shared variables?

Post 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.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: What is the equivalent to Crystal shared variables?

Post 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.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: What is the equivalent to Crystal shared variables?

Post by Lech Kulikowski »

Hello

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

Thank you.
Post Reply