Initializing help system before first use

Adding an Attachment in Development

Adding an attachment while developing an Xpress Insight app can be as simple as creating a file in the attachments directory.
The example project is to be extended by loading some standard investment warning advice from a string stored in an app-level attachment. Initially, it will contain placeholder text, but later, it will be edited and updated from the app itself, demonstrating how the model interacts with attachments.
  1. Create a file called caution.txt and save it in your app's root folder—its contents should be:
    cautionText:"** Text to be replaced **"
    The organization of your app now looks like:

    Adding an Attachment

    Folder Hierarchy After Adding an Attachment

  2. 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
  3. 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 to insightgetappattach 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 the cautionText value with that assigned in caution.txt - i.e. ** Text to be replaced **.

  4. Change foliodata.vdl so that its first few lines now read:
    <vdl version="4.7">
       <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">
    ...
    The <span> element has a vdl-text attribute that uses an expression to evaluate and insert the runtime value of the cautionText entity.

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