Access String List of variable

Stimulsoft Reports.JS discussion
Post Reply
ga6riel
Posts: 10
Joined: Mon May 13, 2019 1:58 pm

Access String List of variable

Post by ga6riel »

Hello,

I have this variable in my report:

Image

How can I access the items list by JavaScript code?

Code: Select all

this.report.dictionary.variables.getByName("breedList").????
Thank you.
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Access String List of variable

Post by Lech Kulikowski »

Hello,

Please check the following code:

Code: Select all

var newVariable = new Stimulsoft.Report.Dictionary.StiVariable();
newVariable.name = "Variable";
newVariable.alias = "Variable";
newVariable.type = Stimulsoft.System.StimulsoftStringList;
newVariable.requestFromUser = true;


var di = new Stimulsoft.Report.Dictionary.StiDialogInfo();
di.allowUserValues = false;
di.keys = ["1", "2", "3", "4"];
di.values = ["1", "2", "3", "4"];


newVariable.dialogInfo = di;


report.dictionary.variables.add(newVariable);
designer.onPreviewReport = function (args) {
  args.report.setVariable("Variable", ["1", "4"]);}
Thank you.
ga6riel
Posts: 10
Joined: Mon May 13, 2019 1:58 pm

Re: Access String List of variable

Post by ga6riel »

Hello,

That's it, thank you!
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Access String List of variable

Post by Lech Kulikowski »

Hello,

We are always glad to help you.

Thank you.
Stevechin83
Posts: 2
Joined: Wed Feb 12, 2020 3:14 am

Re: Access String List of variable

Post by Stevechin83 »

Hello,

If i want to select all list element to filter, how should I pass the data from C#?

Thank you.
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Access String List of variable

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.
Post Reply