Page 1 of 1

How to populate a Variable List

Posted: Wed May 10, 2017 5:25 am
by james.crossley
I'd be grateful for some advice on how to pass a list as a parameter to my report.

From the Parameter panel on my report, the user will select from a list of months from a dropdown list.

The list will be dynamically created and will be constructed like this:

Key, Value
May 2017, 0
April 2017, -1
March 2017, -2
February 2017, -3
January 2017, -4
etc

I'm familiar with passing a string as a parameter to my report;

e.g.

Code: Select all

reportToView.Dictionary.Variables.Add(new StiVariable("QueryStringParameters", "EntityId", typeof (int), entityId, true));
How do I pass a list of keys and values to populate the parameter variable list?

Thanks
James

Re: How to populate a Variable List

Posted: Thu May 11, 2017 9:54 am
by Alex K.
Hello,

Please try to check the following code:

Code: Select all

report.Dictionary.Variables.Add(new StiVariable("", "Variable1", "Variable1", "", typeof(StringList), "", false, StiVariableInitBy.Value, true, new StiDialogInfo(StiDateTimeType.Date, "", true, new string[] {
                    "1",
                    "2"}, new string[] {
                    "1",
                    "2"}), null, false, StiSelectionMode.FromVariable));
Thank you.

Re: How to populate a Variable List

Posted: Mon Jun 05, 2017 6:47 am
by james.crossley
Aleksey
My apologies for the delayed answer.
Thank you for your help.
James

Re: How to populate a Variable List

Posted: Mon Jun 05, 2017 7:04 am
by Alex K.
Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.