Delete Records

Before you begin

This procedure requires that you have created and populated a table. See Table Widget Data Population Examples

Prepare the Blockly Code

About this task

To delete table records, perform the following:

Procedure

  1. In the Canvas, click the table widget in your app.
  2. In the Table Properties panel, under the Actions section, check the Delete Records checkbox.
  3. Below the checkbox, click the Add button. The Blockly editor will open.
  4. In the Blockly Name field, enter a name for the Blockly script.
  5. In the Blockly editor's left-hand panel, click the Connections group and drag a connection block into the main area.
    Connection block with default settings
  6. In the REST dropdown, select DELETE to allow data to be removed from the data source.
  7. Click the Text block group, drag the create text with block to the connection block, and drop it in the URL field.
    Connection block configured for DELETE and the create text with block
  8. Click the Text group again, drag the white quote bubble to the connection block, and drop it in the first open field within the create text with block. In the white quote bubble, enter the address of the database API (Application Programming Interface) connection.
    Connection block configured with the address
  9. Click the Table group, drag the selected row block to the connection block, and drop it in the remaining open field within the create text with block. In the selected row dropdown, choose the name of the table that will be edited. In the column dropdown, select the column that uniquely identifies the record.
    Connection block configured for the table row
  10. To update the data on the table after an edit is committed, you must request an update. Click the Table group, and drag the refresh table block to the on success section of the connection block. From the refresh table dropdown, select the name of the table to be refreshed.
    Connection block configured with a refresh table block
  11. Click Save. You will return to the Canvas.
  12. Select Save in the SOTI Snap banner to apply your changes.
    Save app button

Test the Blockly Code

About this task

To test your Blockly code, perform the following:

Procedure

  1. In the Canvas, click the preview button to run the app. The Preview Options window will open.
    Image of the preview button
  2. Click Preview to accept the default skin. The app will open.
  3. Select a table row, and click the More button. Click Delete. A pop-up will open to confirm the deletion. Click Delete.
    Edit and delete options of the More button

Results

Deleted records should be reflected in the table's row data. If not, check steps taken under Table Widget Data Population Examples and Prepare the Blockly Code above.