Setting the Variable Value from Code
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.Report variables can be assigned from code before rendering — for values that come from the application rather than the data.
Get a variable and set its value.
How it works. Values are set on the report object prior to rendering, so the output reflects data supplied by the page code.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Get a variable and set its value.
var report = new Stimulsoft.Report.StiReport();
report.loadFile("../reports/ReportWithVariable.mrt");
var variable = report.dictionary.variables.getByName("Variable1");
variable.value = "test";
report.renderAsync(function () { /* report is built */ });report.dictionary.variables.getByName("Variable1")— look up a template variable by name.variable.value = ...— assign beforerenderAsyncso the value flows into the rendered report.
How it works. Values are set on the report object prior to rendering, so the output reflects data supplied by the page code.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
