Page 1 of 1

How to set list of string options for a parameter in Stimulsoft JS (React)?

Posted: Thu Aug 21, 2025 6:33 am
by Tri
I’m using Stimulsoft Reports.JS in a React project.
In my report, I have a parameter with type is List String (variable) called MyParam. I want this parameter to be shown in the viewer toolbar as a dropdown, and the list of string options should be provided dynamically from my React code (e.g., from an API).

Re: How to set list of string options for a parameter in Stimulsoft JS (React)?

Posted: Mon Aug 25, 2025 7:32 pm
by Lech Kulikowski
Hello,

You can use 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);
Thank you.