Initializing help system before first use

Improving the User Interface

While it is perfectly functional, the app is rather wasteful of screen real estate and it would be a better approach to let the user select a share type from a drop-down list before changing its estimated ROI.

Doing this requires a slight change to the model, and this illustrates the iterative nature of Xpress Insight solution development. Start with a basic model, create an interface and iterate both as you seek to improve the user experience.

The model needs a scalar entity in which to store the selected share name from the proposed drop-down list. Modify the public declarations section of foliodata.mos by declaring the entity changeShare, adding it at the bottom:
public declarations
  ...
  RET: array(SHARES) of real
  !@insight.manage input
  changeShare: string
end-declarations
For this example, a simple way to initialize it is by modifying the datainput procedure so that it now defines an initial value for the new scalar:
! Load input data
 procedure datainput
   initializations from DATAFILE
       RET RISK NA
   end-initializations
   changeShare:= "brewery"
 end-procedure
Replace the <vdl-form> containing the repeating fields, with a new form containing just two fields, so that the full foliodata.vdl file now reads:
<vdl version="4.7">
    <vdl-page>
        <vdl-section heading="Welcome to Portfolio Optimization" heading-level="1">
            <vdl-row>
                <vdl-column heading="Return per share type" heading-level="2" size="4">
                    <vdl-form>
                      <vdl-field entity="changeShare" options-set="SHARES" label="Choose share type"></vdl-field>
                      <vdl-field entity="RET" indices="=scenario.entities.changeShare.value" label="Estimated ROI"></vdl-field>
                    </vdl-form>
                    <vdl-execute-button caption="Run scenario"></vdl-execute-button>
                </vdl-column>
            </vdl-row>
            <vdl-row>
                <vdl-column heading="Optimal result" heading-level="2">
                    <span vdl-text="Calculated optimal return: "></span>
                    <span vdl-text="=insight.Formatter.formatNumber(scenario.entities.Return.value, '00.##')"></span>
                </vdl-column>
            </vdl-row>
            <vdl-row>
                <vdl-column heading-level="3" heading="Recommended share allocations">

                    <vdl-table page-mode="paged" page-size="5" show-filter="true" column-filter="true">
                        <vdl-table-column entity="frac"></vdl-table-column>
                        <vdl-table-column entity="RET"></vdl-table-column>
                    </vdl-table>
                </vdl-column>
            </vdl-row>
        </vdl-section>
    </vdl-page>
</vdl>
The first new <vdl-field> element has its entity attribute set to changeShare - the new entity in the model. By using the options-set attribute, Xpress Insight is informed that the field should be a drop-down list, taking its set of options from the SHARES set. The field is completed with the assignment of a label.

The second new <vdl-field> element references the RET array, with its indices attribute set to the value stored in the changeShare entity. Again, a suitable label is provided.

Republish, reload and rerun the scenario:
Improving the User Interface

Improving the User Interface

The result is a much more compact user interface that conforms better to expectations.

Should you need them, radio buttons and check boxes are available as alternative VDL field types.

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