Controlling Element Visibility Based on Results
If a user opens the app as it exists currently, the input data and un-calculated result values will be displayed by default.
To improve the interface, we will hide the Results Row until the scenario has run and there are results to display. At the same time we will display an instruction to run the optimization.
- Firstly we shall hide the Results Row if there are no result data. In the Palette > Logic group, click and drag an If element onto Row containing the RESULTS and SCENARIO COMPARISON Column elements on the artboard. The If Wizard is displayed:
- In the upper pane, enter the text below, including the equals sign.
=scenario.summaryData.hasResultData
- Click FINISH.
- In the upper pane, enter the text below, including the equals sign.
- Now we shall add an instruction to run the scenario if there are no results. Locate the Section on the artboard, which has the title "Welcome to Portfolio Optimization". From the Palette, drag a Layout > Row element and drop it onto the Section.
- From the Palette, drag a Layout > Column element and drop it onto the Row. Edit the Row Attributes > Heading to read "No results - run optimization".
- In the Palette > Logic group, click and drag an If element onto Row. The If Wizard is displayed:
- In the upper pane, enter the text below, including the equals sign.
=!scenario.summaryData.hasResultData
- In the upper pane, enter the text below, including the equals sign.
- Finally, select the Section on the artboard that has the title "Welcome to Portfolio Optimization". Delete the Heading attribute.
Conclusion
The first time a user opens the app, and whenever the default data is loaded, the result Row is hidden and an instruction to run the optimization is displayed.

After the scenario has been run, the message is replaced by the Results row.
