Initializing help system before first use

vdl-var

Set a dynamic variable to the result of an expression. The value expression is ignored if the persist flag has been set and the variable has been written to directly or via a vdl action.

since 4.8

Example

<!-- View-scoped variable, evaluated each time the view is loaded -->
<vdl-var name="NUM_SCENARIOS" value="=scenarios.length"></vdl-var>
<!-- Variable that is persisted between views and reloads -->
<vdl-var name="userSelectedOption" value="defaut-option" persist="true"></vdl-var>
<!-- Variable that is scenario-scoped, to the first scenario in the selection -->
<vdl-var name="scenarioProductFilter" value="featured" scenario="0"></vdl-var>
<!-- Using a variable that is scenario-scoped, to the first scenario in the selection -->
<p vdl-text="=scenario.vars.scenarioProductFilter"></p>
<!-- Alternatively, the index can be provided -->
<p vdl-text="=scenarios[0].vars.scenarioProductFilter"></p>

Attributes

name Name of the variable. This must be a unique name globally, or if the scenario attribute is specified it must be unique within that scenario. since 4.8 required
value Value of the variable. since 4.8 accepts expression required
persist If set to true then whenever the variable is written to, for example calling vdl-action-set-var, it will store that value in browser storage so that it is restored on view reload or navigation. If the variable has a value in browser storage it will ignore the value expression set on vdl-var declaration. The variable will be restored based on the app and logged in user. If the variable is scenario scoped then the value will only be restored for the matching scenario. Accepts "true" or "false", defaults to "false". since 5.0
scenario Optional scenario index to set the variable on. It sets the variable as scenario scoped and assigns it to the scenario specified by this index. If no scenario attribute is specified then the variable will be scoped to the view and if persisted it will be restored throughout the view in the app, regardless of when scenarios are on the shelf. since 4.8 accepts expression

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.