Check if a report variable is used in the report

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Check if a report variable is used in the report

Post by Fabio Pagano »

Good morning.

I need to programmatically check (eg. From Visual Basic or C#) if a report variable present in the dictionary is effectively used (designed)in the report.

Is there a way to do this?

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Check if a report variable is used in the report

Post by HighAley »

Hello.
Fabio Pagano wrote:I need to programmatically check (eg. From Visual Basic or C#) if a report variable present in the dictionary is effectively used (designed)in the report.

Is there a way to do this?
Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Check if a report variable is used in the report

Post by Fabio Pagano »

In the dictionary of our reports we have report variables, that the user may or may not use in the report.

I need to programmatically know if a report variable is used in the report: in this case, when i pass data to the report, I will not assign values to these report variables because some of them are images and may be very large, so my intention is to pass the values to the report variables only if needed, that is only if they are effectively designed in the report.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Check if a report variable is used in the report

Post by HighAley »

Hello.
Fabio Pagano wrote:In the dictionary of our reports we have report variables, that the user may or may not use in the report.

I need to programmatically know if a report variable is used in the report: in this case, when i pass data to the report, I will not assign values to these report variables because some of them are images and may be very large, so my intention is to pass the values to the report variables only if needed, that is only if they are effectively designed in the report.
Unfortunately, there is no build-in methods. But you could run throw all components of the report and check if there any variable is used.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Check if a report variable is used in the report

Post by Fabio Pagano »

Good morning.
But you could run throw all components of the report and check if there any variable is used.
Do you kindly have a sample code?

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Check if a report variable is used in the report

Post by HighAley »

Hello.

Next code sample will help you:

Code: Select all

foreach (StiComponent comp in rep.GetComponents())
{
    IStiFont fnt = comp as IStiFont;
    if (fnt != null)
    {
        fnt.Font = StiFontUtils.ChangeFontName(fnt.Font, "Courier New");
    }
}
Thank you.
Post Reply