VDL Entity editing
Toggle Boolean Scalar
This example uses a button to trigger the vdl action stored in an action group that toggles the myBool entity value. The action is called from the button by referencing the name of the action group.

<vdl-page> <vdl-header draggable="true"> <vdl-action-group draggable="true" name="update_Ent"> <vdl-action-update-entity value="=!scenario.entities.myBool.value" entity="myBool"></vdl-action-update-entity> </vdl-action-group> </vdl-header> <vdl-section heading="VDL Entity 1"> <vdl-row> <vdl-column size="12"> <vdl-form> <vdl-field entity="myBool"></vdl-field> <vdl-button vdl-event="click:actions.update_Ent" label="Update"></vdl-button> </vdl-form> </vdl-column> </vdl-row> </vdl-section> </vdl-page>
Remove Scalar Value
The vdl-action-remove-entity action sets a scalar to its default value. For each data type, these are; INTEGER=0, REAL=0, BOOLEAN=false, and STRING="".
<vdl-page> <vdl-header draggable="true"> <vdl-action-group draggable="true" name="remove_Ent"> <vdl-action-remove-entity value="=!scenario.entities.myBool.value" entity="myBool"></vdl-action-remove-entity> </vdl-action-group> </vdl-header> <vdl-section heading="VDL Entity 2"> <vdl-row> <vdl-column size="12"> <vdl-form> <vdl-field entity="myBool"></vdl-field> <vdl-button vdl-event="click:actions.remove_Ent" label="Remove"></vdl-button> </vdl-form> </vdl-column> </vdl-row> </vdl-section> </vdl-page>
Update Entity Array with Indices
Update a value in a multi-dimensional array by specifying the array, indices, and value. The vdl-action-update-entity example here increments the value for New York, January in the array FactorySupply.
<vdl-page> <vdl-header draggable="true"> <vdl-action-group draggable="true" name="update_Ent"> <vdl-action-update-entity entity="FactorySupply" value="=scenario.entities.FactorySupply(['New York', 'January']).value + 1" scenario="0" indices="=['New York', 'January']"> </vdl-action-update-entity> </vdl-action-group> </vdl-header> <vdl-section heading="VDL Entity 3"> <vdl-row> <vdl-column size="12"> <vdl-form> <vdl-field entity="FactorySupply" indices="New York,January"></vdl-field> <vdl-button vdl-event="click:actions.update_Ent" label="Update"></vdl-button> </vdl-form> </vdl-column> </vdl-row> </vdl-section> </vdl-page>
Remove Array Value
The vdl-remove-entity option can be used with an array to remove the value at a specified position in the array.
<vdl-page> <vdl-header draggable="true"> <vdl-action-group draggable="true" name="remove_Ent"> <vdl-action-remove-entity entity="FactorySupply" value="=scenario.entities.FactorySupply(['New York', 'January']).value + 1" scenario="0" indices="=['New York', 'January']"> </vdl-action-remove-entity> </vdl-action-group> </vdl-header> <vdl-section heading="VDL Entity 4"> <vdl-row> <vdl-column size="12"> <vdl-form> <vdl-field entity="FactorySupply" indices="New York,January"></vdl-field> <vdl-button vdl-event="click:actions.remove_Ent" label="Remove"></vdl-button> </vdl-form> </vdl-column> </vdl-row> </vdl-section> </vdl-page>
Update Parameter
The following example uses a vdl action attached to a Button to update the parameter MyParam (displayed in a vdl field) with a randomly generated number.
<vdl-action-group name="demo3"> <vdl-action-update-entity parameter="MyParam" value="=Math.random() + ''" scenario="0" ></vdl-action-update-entity> </vdl-action-group> <vdl-form> <vdl-field parameter="MyParam" ></vdl-field> </vdl-form> <button class="btn-primary" vdl-event="click:actions.demo3">Demo3</button>
Remove Param Value
The vdl-remove-entity action can be used to delete a parameter.
<vdl-action-group name="demo4"> <vdl-action-remove-entity parameter="MyParam" scenario="0"></vdl-action-remove-entity> </vdl-action-group> <vdl-form> <vdl-field parameter="MyParam"></vdl-field> </vdl-form> <button class="btn-primary" vdl-event="click:actions.demo4">Remove parameter MyParam</button>
Remove Set Value
The vdl remove entity action can be used to delete a set of data.
<vdl-action-group name="demo4"> <vdl-action-remove-entity set="Factories" indices="='New York'" scenario="0"></vdl-action-remove-entity> </vdl-action-group> <vdl-form> <i vdl-repeat="=item in scenario.entities.Factories" vdl-text="=item.label + ' '"></i> </vdl-form> <button class="btn-primary" vdl-event="click:actions.demo4">Remove New York factory</button>