Initializing help system before first use

VDL Conditions

VDL Actions can update a variable based on an existing value. For the latest versions of these examples, visit the FICO VDL Online Reference.

Toggle a Boolean Value

This example uses a Javascript variable (toggleVar) to toggle the vdl-var item value between true and false.

Code editor
<script>
    function toggleVar(vm) {
        vm.vars.AGenabled(!vm.vars.AGenabled());
    }
</script>

<vdl-var name="AGenabled" value="=true"></vdl-var>

<vdl-action-group name="toggleActionGroup">
    <vdl-action command="toggleVar"></vdl-action>
</vdl-action-group>

Execute an Action if a Value Evaluates to True

In this example, the second action only runs if the vdl-var has a value of true.

Code editor
<script>
    function display(vm, evt, value) {
        window.alert("Value is: " + value);
    }
</script>
<vdl-action-group name="doCalc">
    <vdl-action command="=100"></vdl-action>
    <vdl-action command="=value * value" vdl-if="=vars.AGenabled"></vdl-action>
    <vdl-action command="display"></vdl-action>
</vdl-action-group>

Using Conditions with an Action Group

It is possible to add a vdl-if conditional attribute to a vdl-action-group tag.

Code editor
<vdl-action-group name="groupHide" vdl-if="=vars.AGenabled">
    <vdl-action command="='Hello'"></vdl-action>
    <vdl-action command="display"></vdl-action>
</vdl-action-group>

<button vdl-event="click:actions.groupHide">Show</button>

© 2001-2020 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.