Adding an Attachment in Development
attachments
directory.
- Create a file called
caution.txt
and save it in your app's root folder—its contents should be:
The organization of your app now looks like:cautionText:"** Text to be replaced **"
Figure : 1. Folder Hierarchy After Adding an Attachment - Change the
declarations
section of foliodata.mos so that it contains an entry for the name of the relevant attachment, and a declaration for the string value to be ultimately read from caution.txt: :SummaryValues: array (SummaryIds) of real cautionText: string ! Constant DATAFILE = "shares.csv" ! Name of attachment to contain caution text CAUTIONTEXT = "caution.txt" end-declarations
- Change the
read_data
procedure in foliodata.mos so that it now reads:... changeShare:= "Brewery" if insightgetmode <> INSIGHT_MODE_NONE then ! Model is running within Insight, so download attachment from Insight server insightgetappattach(CAUTIONTEXT) if insightattachstatus<>INSIGHT_ATTACH_OK then writeln("Failed to download app attachment") exit(1) end-if end-if initializations from CAUTIONTEXT cautionText end-initializations writeln("Loading finished.") ...
Note: Attachment retrieval should always be accompanied by a status (error) check.The call toinsightgetappattach
causes Xpress Insight to locate the caution.txt file in attachments, and copy it into its working directory, whereupon it can be manipulated using Mosel's standard data manipulation functions.The second call to
initializations
initializes thecautionText
value with that assigned in caution.txt - i.e.** Text to be replaced **
. - Change foliodata.vdl so that its first few lines now read:
The<vdl version="5.8"> <vdl-page> <vdl-section heading="Welcome to Portfolio Optimization" heading-level="1"> <vdl-row> <vdl-column><span vdl-text="=scenario.entities.cautionText.value"></span></vdl-column> </vdl-row> <vdl-row> <vdl-column heading="Return per share type" heading-level="2" size="4"> ...
<span>
element has avdl-text
attribute that uses an expression to evaluate and insert the runtime value of thecautionText
entity.
© 2001-2025 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.