regarding accessing the number and names of the variables in .mrt files

Stimulsoft Reports.WEB discussion
Post Reply
AbdulAleem
Posts: 37
Joined: Tue Sep 15, 2009 9:42 am
Location: jeddah

regarding accessing the number and names of the variables in .mrt files

Post by AbdulAleem »

Hi,

Can you give code how to find the number and names of the variable can be fetched from .mrt file.

My requirement is I want to create report dynamically and when I do so immediately I want to generate user interface to pass parameters to the report from aspx page.

Thanks
Abdul Aleem
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

regarding accessing the number and names of the variables in .mrt files

Post by Edward »

Hi Abdul,

You can add variables and categories in the following way:

Code: Select all

report.Dictionary.Variables.Add("MyCategory1");
if (report.Dictionary.Variables["MyVariable"] == null)
   report.Dictionary.Variables.Add(new StiVariable("Category2", "MyVariable", typeof(int), "1", false));

And there is a method to count all variables in the Dictionary:

Code: Select all

int variables=0;
foreach (StiVariable variable in report.Dictionary.Variables)
{
  if (!variable.IsCategory) variables++;
}
assigning of the variable is very simple too:

Code: Select all

report["MyVariable"] = 5;
Thank you.
Post Reply