Check to see if variable exists in dictionary

Stimulsoft Reports.NET discussion
Post Reply
bclay
Posts: 2
Joined: Fri Aug 27, 2010 5:08 pm
Location: Park City, Utah

Check to see if variable exists in dictionary

Post by bclay »

I wanted to know if there was a way I could check to see if a variable has been added to the report dictionary.

For example, in my code I have this expression:

StiReport report = new StiReport();

if (Add == true)
{
report.Dictionary.Variables.Add(new StiVariable("Custom", "Title", "Report"));
}

In the Report Designer, is there a function or expression that I can use to determine if the variable "Title" exists in the report dictionary?

Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Check to see if variable exists in dictionary

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

foreach (Stimulsoft.Report.Dictionary.StiVariable var in report.Dictionary.Variables)
{
      if (var.Name == "VariableAddName")
      {
            Add = false;
      }
}
Thank you.
Jose
Posts: 16
Joined: Thu Oct 17, 2019 8:42 am

Re: Check to see if variable exists in dictionary

Post by Jose »

StiReport report = new StiReport();

if (report.Dictionary.Variables.Contains("variablename") == true)
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Check to see if variable exists in dictionary

Post by Lech Kulikowski »

Hello,

Thank you.
Post Reply