Justinmind

SUPPORT

Learn how to prototype web and mobile apps

Operations with Data Masters


In this tutorial, you will find an overview of all the possible operations you can perform with Data Masters.

Create New Records

Creating new records for a Data Master can be easily achieved through the events system. To create a new record instance for a specific Data Master, follow these steps:

1) Select the widget that will trigger the event on the canvas, i.e. a button that says “Add”.

2) Add an “On click” + “Data Master action” event.

3) Select the Data Master you want to add records to and click on the ‘New’ button. The Expression Builder will appear with a New expression.

4) Create the expression filling the required parameters with any data sources (i.e. input field values).

5) Add a “Set Value” action, selecting the entire Data List as the component that will show the value, and the “Calculated” radio button at the bottom of the events dialog. Then click on “Add expression” and drag the Data Master from the Data Master tab to the expression. Press OK twice.

create-new-records-data-master

Note that all the instances you create during simulation will be deleted once you stop simulating.

You can find here a more detailed tutorial on how to create new records (Add rows to a Data List).

Edit Data Master Records

You can modify a specific record instance or a group of instances in a Data Master using event during simulation. To modify records from a specific Data Master, follow these steps:

1) Select the widget that will trigger the event on the canvas.

2) Click on ‘Add event’ in the Events panel and add an “On Click” + “Data Master Action” event.

3) Select the Data Master you want to modify records from and click on the ‘Modify’ button. The Expression Builder will appear with a Modify expression.

4) Create the expression filling the required parameters with any data sources. Notice that the first parameter of the expression refers to the record or records collection you want to modify.

update-records-data-master

5) Add a “Set Value” action, selecting the entire Data List as the component that will show the value, and the “Calculated” radio button at the bottom of the events dialog. Then click on “Add expression” and drag the Data Master from the Data Master tab to the expression. Press OK twice.

Note that all the instances you modify during simulation will be restored once you stop simulating.

You can find here a more detailed tutorial on how to edit records (Edit rows in a Data List).

Delete Data Master Records

You can delete a specific record instance or a group of instances of a Data Master using event actions during simulation. To delete records from a specific Data Master, follow these steps:

  1. Select the widget that will trigger the event on the canvas.
  2. Add an “On Click” + “Data Master Action” event.
  3. Select the Data Master you want to delete records from and click on the ‘Delete’ button. The Expression Builder will appear with a Delete expression for the Data Master specified.
  4. Create the expression filling the required parameter with a data source. Notice that the first and only parameter of the expression refers to the record or records collection you want to delete.

The expression in the first image below deletes all users from the Data Master “Users”. The expression in the second image deletes all users matching user name Bob.

delete-records-data-master

Note that all the instances you delete during simulation will be restored once you stop simulating.

You can find here a more detailed tutorial on how to delete records (Delete rows from a Data List).

Read Data Master Records

You can get any information out of a Data Master, Data Grid or Data List in order to use it for other calculations or just to display it separately using event actions.

To get a specific Data Master’s record instance or a collection of them, use one of the following data sources in the Expression Builder:

  • Data Master: Represents the collection of all the Data Master’s instances.
  • Data List: Represents the collection of all the Data Master’s instances currently displayed by the Data List.
  • Data List’s row: Represents the instance displayed by the current row.
  • Data Grid: Represents the collection of all the Data Master’s instances currently displayed by the Data Grid.
  • Data Grid’s cell: Represents the instance displayed by the current cell.
  • Variable: Container of any of the mentioned data types above.

Additionally you can filter any of the data sources mentioned above in order to get a more specific record instance. To do so, you will need to create a Filter expression in the Expression Builder dialog.

To get a specific field from a Data Master’s record instance in the Expression Builder you will have to use the Select function. The Select function needs two parameters:

  • First parameter: Introduce a Data Master’s record instance or a collection of instances here. To do so, you can drag and drop any Data Master, Data List, Data List’s row, Data Grid, Data Grid’s cell or Variable containing record instances.
  • Second parameter: Introduce the Data Master’s field you want to get from the instances’ collection here.

If the first parameter defines a collection of record instances, then the select operation will return a list of values.

If the first parameter defines a single record instance, then the select operation will return a single value.

Next tutorial > Add rows to a Data List