VDL Loops
Loop through all the Actions in a group a specified number of times
- The first Action returns the value 2.
- The second Action multiples the value by itself; The embedded vdl-repeat command executes the calculation 3 times, so the initial value is squared 3 times.
-
The third action displays the final result in an on-screen element named logPanel.

<script> function addToLog(vm, evt, value) { var logPanel = document.getElementById('log-panel'); var logItem = document.createElement('div'); logItem.classList.add('log-item'); var date = (new Date()).getTime(); var text = document.createTextNode(date + ': ' + value); logItem.appendChild(text); logPanel.appendChild(logItem); logPanel.scrollTo(0, 100000); } </script> <vdl-page> <vdl-header> <vdl-action-group name="demo2"> <vdl-action command="=2"></vdl-action> <vdl-action command="=value * value" vdl-repeat="=num in [1,2,3]"></vdl-action> <vdl-action command="addToLog"></vdl-action> </vdl-action-group> </vdl-header> <vdl-section> <vdl-row> <vdl-column size="12"> <div id="log-panel"></div> <vdl-button label="Trigger log" vdl-event="click: actions.demo2"></vdl-button> </vdl-column> </vdl-row> </vdl-section> </vdl-page>
<script> function addToLog(vm, evt, value) { var logPanel = document.getElementById('log-panel'); var logItem = document.createElement('div'); logItem.classList.add('log-item'); var date = (new Date()).getTime(); var text = document.createTextNode(date + ': ' + value); logItem.appendChild(text); logPanel.appendChild(logItem); logPanel.scrollTo(0,100000); } </script>
<vdl-action-group name="demo1"> <vdl-action command="=99"></vdl-action> <vdl-action command="addToLog"></vdl-action> </vdl-action-group>
© 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.