Page 1 of 1

Creating new Variables via Code

Posted: Mon Feb 29, 2016 10:09 am
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

Re: Creating new Variables via Code

Posted: Mon Feb 29, 2016 11:46 am
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.