Using Report Variables in Code
Our sample projects and report templates can help you learn the basics of working with our products.Report variables can be assigned from code before rendering — handy for passing application state into a template (Vue).
Set variables, then bind the viewer.
How it works. Values are set on the report before it is bound to
Set variables, then bind the viewer.
<script setup lang="ts">
import { Viewer, Stimulsoft } from 'stimulsoft-reports-js-vuejs/viewer'
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Reports/Variables.mrt");
report.setVariable("Name", "Andrew");
report.setVariable("Sex", true);
report.setVariable("BirthDay", Stimulsoft.System.DateTime.fromString("10.10.2010"));
</script>
<template>
<Viewer :report="report" />
</template>report.setVariable(name, value)— assign each template variable by name before the viewer renders it.Stimulsoft.System.DateTime.fromString— build a date value forDateTimevariables.
How it works. Values are set on the report before it is bound to
<Viewer>, so the rendered document reflects the application's state.