Creating new Variables via Code

Stimulsoft Reports.JS discussion
Post Reply
Loki87
Posts: 19
Joined: Thu Dec 10, 2015 1:17 pm

Creating new Variables via Code

Post by Loki87 »

Hello,

is there a way, I can create variables via code, when there are undefined before.
I know how to edit variables that are existing, but for creating variables in the designer via code, I didn't found a solution.

Thank you

Best regards
loki
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Creating new Variables via Code

Post by HighAley »

Hello.

You could add a variable with next code:

Code: Select all

var newVariable = new Stimulsoft.Report.Dictionary.StiVariable();
...
report.dictionary.variables.add(newVariable);
Before adding it to the report you could set next properties:

Code: Select all

category: string = String.empty,
name: string = String.empty,
alias: string = String.empty,
description: string = String.empty,
typeT: Type = String.getType(),
value: string = String.empty,
readOnly: boolean = false,
initBy: StiVariableInitBy = StiVariableInitBy.Value,
requestFromUser: boolean = false,
dialogInfo: StiDialogInfo = new StiDialogInfo(),
key: string = null, allowUseAsSqlParameter: boolean = false
Thank you.
Post Reply