Page 1 of 1

How to set primary variables? * SOLVED *

Posted: Tue Nov 30, 2010 3:20 am
by sadeqi
Hi, How we can register primary data types like "string" in a report. We have .mrt report files that we load them while passing the date to them.
We have tried "RegData" method but after loading it treats the string variable like a "Char Array" and we tried the following code before loading the report with no success:

Code: Select all

        public void RegVar(string key, object value)
        {
            if(!this.report.IsCompiled)
            {
                this.report.Compile();
            }
            if (this.report.Dictionary.Variables.Contains(key))
            {
                this.report.Dictionary.Variables[key].ValueObject = value;
                this.report.Dictionary.Variables[key].Value = value.ToString();
            }
            else
            {
                this.report.Dictionary.Variables.Add(new StiVariable(key, value));
            }
       }
and this one:

Code: Select all

        public void RegVar(string key, object value)
        {
            this.report[key] = value;
         }

How to set primary variables? * SOLVED *

Posted: Tue Nov 30, 2010 4:34 am
by sadeqi
This solution solved my problem.

Code: Select all


this.report.Dictionary.Variables.Add("Variable", key, value.GetType(), value.ToString(), false);


How to set primary variables? * SOLVED *

Posted: Tue Nov 30, 2010 4:43 am
by Andrew
Ok!

Have a nice day!