MDK User's Guide: 4 Create Togglable Boolean Values

Another relevant feature of View Editor is the option to have an element's value be Boolean. In View Editor, this is shown as a toggable check box indicating if a value is "True" or "False". This can be extremely useful for all elements that require a quick Boolean answer.

These instructions demonstrate how to create togglable Boolean values so that they may be seen as check boxes on View Editor. This example builds off of Create and Generate a Rapid Table for the first table column and Create Enumerated Values for the second table column.

 

Create Togglable Boolean

  1. For each component that will utilize a togglable boolean, create a value property

    • Right click component > create element > value property

    • Name the value property

  2. Set the default value of the value property to literal boolean

    • Double click the value property or right click > specification

    • In the default value field, select the arrow to the right of the field box > value specification > literal boolean

    • The default value is now a togglable true/false

Implementation in the context of a View Editor Table

The following instructions demonstrate how to create enumerated values so that they may be seen as drop down lists in the column of a Rapid Table (Create and Generate a Rapid Table) on View Editor.

  1. Create a View diagram, document, view, and view point method diagram as described in Create A Document With A View and Insert Diagram as Image

 

  1. In the viewpoint method diagram, include the following elements:

    • Initial node

    • CollectOwnedElements

    • FilterByStereotypes with stereotypes field set to the element type containing value properties with literal boolean (ex. block)

    • Table Structure

    • Activity Final node

  2. Within the Table structure, include the following elements:

    • Initial node

    • TableAttributeColumn with desired attribute (ex. name)

    • TableAttributeColumn with desired attribute set to "value"

    • Activity Final node 

  3. Within the TableAttributeColumn with the attribute set to "value", include the following elements:

    • Initial node

    • CollectOwnedElements

    • FilterByNames with the NameChoosable field set to the name of the value property with a literal boolean

    • Activity Final node

  4. Define control flow between all elements on the diagram. The figure below shows the viewpoint method diagram, including the TableAttributeColum from the Create Enumerated Values example.

 

  1. Save Changes

  2. Generate document

    • Right click document > MMS > Generate View Contents Recursively

  3. See that table is generated in View Editor that includes the name of the element and its value (either true or false). When the value is edited, the user can toggle between true or false. 

Â