Setting Report Variables on the Server-Side
Our sample projects and report templates can help you learn the basics of working with our products.Report variables can be assigned on the server before rendering, through the
Set variable values in the event.
How it works. Values chosen on the server are injected into the report generator, so the client renders with data it never had to supply.
onPrepareVariables event.Set variable values in the event.
def prepareVariables(args: StiVariablesEventArgs):
if len(args.variables) > 0:
args.variables['Name'].value = 'Maria'
args.variables['Surname'].value = 'Anders'
args.variables['Sex'].value = False
args.variables['BirthDay'].value = datetime(1982, 3, 20)
viewer.onPrepareVariables += prepareVariablesonPrepareVariables— receives the report's variables before rendering; assign each by name.- Value types must match the template (str, bool,
datetime, …).
How it works. Values chosen on the server are injected into the report generator, so the client renders with data it never had to supply.