Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This would also allow more complex cases than just if-else. For example, suppose we are reading from an employees table, adding categories to each employee, then writing and we want to write the employee salary to a table that will help calculate average salaries per category.  Before we add categoriesgroups salaries by several categories. If an employee is over a certain age, we want to do a lookup their retirement plan lookup if . If the employee's age is greater than 65. Before we add categories, we also nationality is x, y, or z, we want to do an immigration status lookup if the employee's nationality is x, y, or z:Image Removed.  No matter what, we want to categorize employee performance before writing to the table:

Image Added

 

Code Block
{
  "connections": [
    {
      "from": "employees table",
      "to": "retirement plan lookup",
      "condition": {
        "script": "function (input) { return input.age > 65; }",
        "scriptEngine": "javascript"
      }
    },
    {
      "from": "employees table",
      "to": "immigration status lookup",
      "condition": {
        "script": "function (input) { return input.nationality == x || input.nationality == x || input.nationality == y || input.nationality == z; }",
  == y || input.nationality == z; }",
        "scriptEngine": "javascript"
      }
    },
    {
      "scriptEnginefrom": "javascriptemployees table",
      "to": "performance }categorizer"
    },
    {
      "from": "retirementperformance plan lookupcategorizer",
      "to": "categorizersalary by category table"
    },
    {
      "from": "immigration status lookup",
      "to": "categorizer"
    },
    {
      "from": "categorizer",
      "to": "salary by category table"
    }
  ]
}

One thing to note is that in this pipeline, an employee that is older than 65 with nationality x will get sent to the categorizer three separate times.  If that is not desired, the conditions would need to reflect thatall three branches to generate each type of category.

Also note that one side effect of this change would be that the filter transform would no longer be needed.

...