With an attachment built-in to the app archive, it is always accessible at runtime (subject to the appropriate permissions).
- Republish your app, then reload and run Scenario 1.
The value loaded into
cautionText from the
caution.txt attachment is displayed:
Loading an Attachment via the App Archive
This demonstrates that the text ** Text to be replaced ** comes from the model as was configured earlier.
- Click the Actions icon
in the top right of the browser, and select App Attachments from the drop-down menu.
Actions Menu
The Attachments Dialog appears, in which a single attachment is listed - caution.txt.
- Click the Edit with Text Editor icon
and replace the existing text with:
cautionText:"WARNING: Share prices can go down as well as up."
- Click Save, Close and Close again.
- Reload Scenario 1.
The caution text has been changed.
Result of Changing an Attachment at Runtime
A runtime change to the attachment has made its way back into the model, where it was marshaled into the cautionText entity and displayed once again. Note, however, that this required a reload of the app data because the code which reads the attachment was added to the datainput procedure. More generally, attachments can be accessed from anywhere in your code and their accessibility is not dependent on reloading data.