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

Stimulsoft Reports.JS discussion
Post Reply
Tri
Posts: 3
Joined: Tue May 27, 2025 6:07 am

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

Post 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).
Lech Kulikowski
Posts: 7354
Joined: Tue Mar 20, 2018 5:34 am

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

Post 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.
Post Reply