Example use cases

Let’s show a practical example of utilizing Rules Engine on Neptune DXP - Open Edition for your no-code application.

In this use case, we will use sample HR employee data to determine employees who would be promoted based on some rules we set up.

Create the rules

  1. Set up a rule.

    rules engine create example
  2. Create attributes for the rule.

    rules engine attributes example
    Ensure that the attribute name matches the name of the table column you want to use it for.
  3. Create a rule with conditions.

    rules engine condition example
    Conditions are in a group function as an AND operation. The result is true if all the conditions are true.
  4. Test your rule.

    rules engine test example
    Test with sample data to be sure your conditions are producing the right result.

Add rules to an application based on the adaptive list template in the Adaptive Designer

  1. Add the desired columns to the table

    rules engine list app image1
    See how to set up an Adaptive List app
  2. Select the column you want to format

    rules engine list app image2
  3. On the right of the panel, under the value tab, select Rules engine as the source

  4. Then, select the Rules you have created.

  5. Select Save.

    rules engine list app image3

    Result:It automatically evaluates the data on your table (attributes on the Rules engine) against the conditions you have in place and shows the results in the selected column.

Add rules to an application in the App Designer using neptune.rulesengine.Rule

  1. From the component library add a neptune.rulesengine.Rule in your Resources.

  2. Adjust the name from Rule to something else.

  3. Select the rule under Properties from your existing rules made in the Rules Engine.

  4. Call the rule:

    1. In a JavaScript file:

      async function myAsynRule() {
        await Rules.{componentName}({attribute:value});
      }
      
      myAsynRule();
    2. In an event script:

      await Rules.{componentName}({attribute:value});

      Where attribute is the name of the Attribute located in the Interface tab within the Rules Engine.

  5. Capture the result of the rule in the ajaxSuccess event of the rule properties:

    const ruleResponse = response.result;
    console.log(ruleResponse);