package
0.0.0-20200821104852-f76c6d292a95
Repository: https://github.com/jvanderl/flogo-components.git
Documentation: pkg.go.dev

# README

Filter Data

This activity provides your flogo application the ability to filter out unwanted data.

Installation

flogo install github.com/jvanderl/flogo-components/activity/filter

Link for flogo web:

https://github.com/jvanderl/flogo-components/activity/filter

Schema

Inputs and Outputs:

{
  "input":[
    {
      "name": "input",
      "type": "string",
      "required": true
    },
    {
      "name": "datatype",
      "type": "string",
      "required": true,
      "allowed" : ["int", "uint", "float32"]
    },
    {
      "name": "minvalue",
      "type": "string"
    },
    {
      "name": "maxvalue",
      "type": "string"
    },
    {
      "name": "inverse",
      "type": "boolean"
    }
  ],
  "output": [
    {
      "name": "pass",
      "type": "boolean"
    },
    {
      "name": "reason",
      "type": "string"
    }
  ]
}

Settings

SettingDescription
inputthe input data
datatypeThe type of data offert (int, uint or float32)
minvalueThe minimum value that gets passed through
maxvalueThe maximum value that gets passed through
inverseInvert the filter, can be used for filtering out a mid-section

Ouputs

OutputDescription
passDetermines if the result should be used or not (true, false)
reasonWhen the data is not to be used, reason explains why

Configuration Examples

Simple

Configure a task in flow to only forward data between 100 and 200 with a 10 second interval:

{
  "name": "testfilter",
  "model": "tibco-simple",
  "type": 1,
  "attributes": [],
  "rootTask": {
    "id": 1,
    "type": 1,
    "activityType": "",
    "name": "root",
    "tasks": [
      {
        "id": 2,
        "name": "Filter",
        "type": 1,
        "activityType": "filter",
        "attributes": [
          {
            "name": "input",
            "value": "150",
            "type": "string"
          },
          {
            "name": "datatype",
            "value": "int",
            "type": "string"
          },
          {
            "name": "minvalue",
            "value": "100",
            "type": "string"
          },
          {
            "name": "maxvalue",
            "value": "200",
            "type": "string"
          },
          {
            "name": "inverse",
            "value": "false",
            "type": "boolean"
          }
        ]
      },
      {
        "id": 3,
        "name": "Log Message",
        "type": 1,
        "activityType": "tibco-log",
        "attributes": [
          {
            "name": "message",
            "value": "",
            "type": "string"
          },
          {
            "name": "flowInfo",
            "value": "true",
            "type": "boolean"
          },
          {
            "name": "addToFlow",
            "value": "true",
            "type": "boolean"
          }
        ],
        "inputMappings": [
          {
            "type": 1,
            "value": "{A2.reason}",
            "mapTo": "message"
          }
        ]
      }
    ],
    "links": [
      {
        "id": 1,
        "from": 2,
        "to": 3,
        "type": 0
      }
    ]
  }
}