Hiding Content when the Result Data is Unavailable
When one or more scenarios have no results data, you can hide the content in portions of your views. This is useful where you are displaying results and comparing multi-scenario views.
To mark a part of a view as dependent on result data, add the
vdl-if attribute to the element and set the expression to check the scenario's
summaryData.hasResultData property. If you are repeating over all scenarios you can check the
summaryData.hasResultData for each scenario, for example:
<vdl-row vdl-repeat="=s in scenarios" vdl-if="=s.summaryData.hasResultData"> <vdl-column heading="=s.props.name"></vdl-column> </vdl-row>If any of the scenarios have no results, you may wish to show a placeholder for that scenario instead of completely omitting that scenario from the view.
The following example loops over all scenarios in the view, creating a section for each. Each section contains a row with a table bound to that scenario and displaying a result entity. This row is only generated for scenarios that have result data. There is an alternative row, containing a "no results" message, for each scenario that is shown when there are no results available for that scenario.
Code editor
<vdl version="4.7"> <vdl-page> <vdl-section vdl-repeat="=s, scenarioIndex in scenarios"> <vdl-row vdl-if="=s.summaryData.hasResultData"> <vdl-column> <vdl-table page-mode="paged" page-size="4" scenario="=scenarioIndex"> <vdl-table-column entity="Shares_fraction"></vdl-table-column> </vdl-table> </vdl-column> </vdl-row> <vdl-row vdl-if="=!s.summaryData.hasResultData"> <vdl-column><span vdl-text="No results available. Run the scenario to analyze results."></span></vdl-column> </vdl-row> </vdl-section> </vdl-page> </vdl>

Hiding Content with no-results