Initializing help system before first use

Accessing Scenario Attachments

Scenarios used in VDL 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 via VDL expressions, they can be accessed via JavaScript.
The following code snippets illustrate several typical VDL operations with attachments. Once again, they use the looping abilities of the vdl-repeat attribute, which is described in detail in Using Loops with Arrays and Sets.
To loop over all scenario attachments:
<ul>
    <li vdl-repeat="=attachment in scenario.attachments()">
        <div vdl-text="=attachment.filename"></div>
        <div vdl-text="=attachment.description"></div>
    </li>
</ul>
To loop over all scenario attachment tags:
<ul>
    <li vdl-repeat="=tag in scenario.attachments.tags()">
        <div vdl-text="=tag.name"></div>
        <div vdl-text="=tag.description"></div>
    </li>
</ul>
To loop over scenario attachment tag names:
<ul>
    <li vdl-repeat="=tagName in scenario.attachments.tagNames()">
        <div vdl-text="=tagName"></div>
    </li>
</ul>
To loop over scenarios that have particular tag assigned to them:
<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>
If no attachments match a tag name then an empty list is returned, which can be subsequently used in a conditional expression:
<div vdl-if="=scenario.attachments.byTagName('unknown-tag').length === 0">
No attachments found with the tag "unknown-tag".
</div>
Conditionals and the <vdl-if> element are described fully in Working with Conditional VDL Attributes.
To access individual attachments by file name:
<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>
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.