Initializing help system before first use

# Accessing Scenario Attachments

Scenarios used in Views can have one or more associated file attachments.

Apps can define attachment tags which are assigned to individual attachments and used when querying the attachments from the view.

Note: Xpress Insight also supports app-scoped attachments (in contrast to scenario-scoped attachments) and while these are not accessible using expressions, they can be accessed with JavaScript.
The following examples illustrate several typical operations with attachments. Once again, they use the looping abilities of the `vdl-repeat` attribute, which is accessible as the Repeat Attribute in the View Designer. For more, see Using Loops with Arrays and Sets.

To loop over all scenario attachments, repeating a row holding text elements:

Code editor

    <vdl-section heading="Accessing Scenario Attachments">
        <vdl-row vdl-repeat="=attachment in scenario.attachments()">
            <vdl-column>
                <span vdl-text="=attachment.filename"></span>
                <span vdl-text="=attachment.description"></span>
            </vdl-column>
        </vdl-row>
    </vdl-section>

View Designer
Figure : 1. Looping using a Container in View Designer

To loop over all scenario attachment tags, repeating a row containing text elements:

Code editor

    <vdl-section>
        <vdl-row vdl-repeat="=tag in scenario.attachments.tags()">
            <vdl-column>
                <span vdl-text="=tag.name"></span>
                <span vdl-text="=tag.description"></span>
            </vdl-column>
        </vdl-row>
    </vdl-section>

View Designer
Figure : 2. Looping using a Row in View Designer

To loop over scenario attachment tag names:

Code editor

    <vdl-section heading="List of Items">
        <vdl-row>
            <vdl-column>
                <ul>
                    <li vdl-repeat="=tagName in scenario.attachments.tagNames()">
                        <div vdl-text="=tagName"></div>
                    </li>
                </ul>
            </vdl-column>
        </vdl-row>
    </vdl-section>

To loop over scenarios that have particular tag assigned to them:

Code editor

    <vdl-section heading="List of Items">
        <vdl-row>
            <vdl-column>
                <ul>
                    <li vdl-repeat="=attachment in scenario.attachments.byTagName('input-sheet')">
                        <div vdl-text="=attachment.filename"></div>
                        <div vdl-text="=attachment.description"></div>
                    </li>
                </ul>
            </vdl-column>
        </vdl-row>
    </vdl-section>

If no attachments match a tag name then an empty list is returned, which can be subsequently used in a conditional expression:
Code editor

    <div vdl-if="=scenario.attachments.byTagName('unknown-tag').length === 0">
    No attachments found with the tag "unknown-tag".
    </div>

For more on conditionals and the `<vdl-if>` element, see Working with Conditional VDL Attributes.

To access individual attachments by file name:

Code editor

    <vdl-row>
        <vdl-column>
            <ul vdl-if="=scenario.attachments('input.xslx').id">
                <li vdl-text="='filename: '+ scenario.attachments('input.xslx').filename"></li>
                <li vdl-text="='description: '+ scenario.attachments('input.xslx').description"></li>
                <li vdl-text="='size: '+ scenario.attachments('input.xslx').size"></li>
            </ul>
        </vdl-column>
    </vdl-row>

When no attachment matches the file name, an empty object is returned. In the above `<ul>` element, the `vdl-if` attribute checks that a matching attachment exists by testing for the `id` property.
Parent Topic Accessing Entities and Other Model Data

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