How to populate a Variable List

Stimulsoft Reports.WEB discussion
Post Reply
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

How to populate a Variable List

Post 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
Attachments
Dialog.png
Dialog.png (19.12 KiB) Viewed 3952 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to populate a Variable List

Post 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.
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Re: How to populate a Variable List

Post by james.crossley »

Aleksey
My apologies for the delayed answer.
Thank you for your help.
James
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to populate a Variable List

Post by Alex K. »

Hello

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

Thank you.
Post Reply