Initializing help system before first use

Accessing Set Entities

Set entities are treated as one-dimensional arrays, each element being an object with a value and a label property.

You can access the elements of a set with the square bracket [ ] notation. Set entities are simple arrays and it is very common to iterate over them.

View Designer

Code editor
<vdl version="4.7">
    <vdl-page>
        <vdl-section heading="Accessing set entities">
            <vdl-row>
                <vdl-column vdl-repeat="=item in scenario.entities.RISK">
                  <span vdl-text="=item.value"></span>
                </vdl-column>
            </vdl-row>
        </vdl-section>
    </vdl-page>
</vdl>
renders as:

A Rendered View of a Set Entity

Rendered View of a Set Entity

For more on loops and the <vdl-repeat> element, see Using Loops with Arrays and Sets.

If you wish to extract individual elements from a set entity, you need to protect the statement with a guard:

<span vdl-text="=scenario.entities.RISK.length && scenario.entities.RISK[0].value ?
scenario.entities.RISK[0].value :
'' ">
</span>

By default, Set data is sorted based on the data type. You can provide custom sorting and/or change the sorting direction to descending, for more, see VDL Set Sorting.

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