Page 1 of 1

Variable string List sample

Posted: Thu Jun 09, 2011 5:21 am
by JorisWils
Hi

I noticed the "list" option in the "new variable"-form.
Is that, for example, a string array?
If it is an array... can it be multi-dimensional?

Are there sample reports on how to add, remove and read listitems from that list in the report from an event?

Is it also possible to populate that list when declaring the variable by using the "expression" option?


My question in short: How does it work? :-)

Variable string List sample

Posted: Fri Jun 10, 2011 2:25 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

report.Dictionary.Variables["VariableName"].DialogInfo.GetDialogInfoItems(typeof(StringList));
Thank you.

Variable string List sample

Posted: Fri Jun 10, 2011 2:28 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

report.Dictionary.Variables["VariableName"].DialogInfo.GetDialogInfoItems(typeof(StringList));
Thank you.

Variable string List sample

Posted: Fri Jun 10, 2011 4:56 am
by JorisWils
Thx a lot. That helped me on my way.

For anyone who wants to do things like this:
I was looking to add values in events whitin a report so I could just make the variable in designer and add values using this code:

Code: Select all

stringlistvariable.Add("myNewString");
I could check for the existance of a value by using:

Code: Select all

stringlistvariable.Contains("myNewString")
And get the index of a certain value by using:

Code: Select all

stringlistvariable.IndexOf("myNewString")

Variable string List sample

Posted: Fri Jun 10, 2011 6:56 am
by Andrew
Hello,

Thank you for sharing your knowledge with other users.