Table of Contents

Chaining actions

This tutorial explains how you can chain actions in a low-code app, so that one action happens after another.

Expected duration: 10 minutes

Prerequisites

Overview

Tip

See also: Kata #8: Actions and events in a low-code app on DataMiner Dojo Video

Step 1: Install the dummy data sources package

  1. Go to https://catalog.dataminer.services/details/package/5410.

  2. Click the Deploy button to deploy the IPAM - GQI dummy data sources packages on your DMA.

    This package contains data that will be used in this tutorial.

Step 2: Create the simulated network scan script

  1. Open DataMiner Cube and go to the Automation module.

  2. Check if the module already contains a folder with the name "Utility", and create this folder if it does not exist yet.

  3. Within this folder, add a new Automation script with the name "Touch".

  4. Add a script parameter named "Path".

    This parameter will contain the path of a file that should be created or updated.

  5. Add a C# action containing the following code:

    engine.Sleep(5000);
    
    string filePath = engine.GetScriptParam("Path")?.Value;
    
    if (string.IsNullOrWhiteSpace(filePath))
        throw new ArgumentException("Invalid file path argument");
    
    using (FileStream fs = File.Create(filePath))
    {
        fs.Close();
    }
    

    Your script should look like this:

    Simulate network scan script

  6. Check whether the script runs correctly:

    1. Click the Execute button.

    2. Provide a path.

    3. Check whether a file is created or updated.

Note

This script invalidates the data that is generated by the "IP addresses - Dummy" ad hoc data source, which will cause the data to be different when it is queried again.

Step 3: Create and configure the header button

  1. Make sure you are editing the app from the Creating and showing a panel tutorial.

  2. Go to the "Metrics" panel.

  3. Click the "+" icon on the left side of the header bar to add a button.

  4. Set the label of the button to "Scan" and select a suitable icon.

  5. Configure the button to execute the script you created in step 2.

    The configuration should look like this:

    Scan action
    DataMiner Low-Code Apps in DataMiner 10.3.12

Step 4: Chain an action

  1. At the bottom of the configuration pane for the button you have just created, click Upon completion.

    This will chain a new action to the previous action. This chained action will be executed as soon as the previous action is completed. The script you configured takes 5 seconds, which means the extra action will only be executed after that time.

  2. Configure the extra action to perform a component action.

    With this action, the data for the state component should be retrieved again so that the component is up to date after the network scan.

    The complete configuration should look like this:

    Consecutive action
    DataMiner Low-Code Apps in DataMiner 10.3.12

  3. Close the action editor and publish the app.

  4. Click the "Scan" button on the "Metrics" panel and check if after 5 seconds the state component shows the latest number of subnets.

Learning paths

This tutorial is part of the following learning path: