package
0.0.0-20230502073429-587acefb9ced
Repository: https://github.com/ayh20/flogo-components.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README


title: Aggregate weight: 4603

Aggregate

This activity allows you to aggregate data and calculate an average or sliding average.

Installation

Flogo Web

https://github.com/ayh20/flogo-components/activity/aggregate

Flogo CLI

flogo install github.com/ayh20/flogo-components/activity/aggregate

Schema

Inputs and Outputs:

{
  "input":[
    {
      "name": "function",
      "type": "string",
      "required": true,
      "allowed" : ["block_avg", "moving_avg", "timeblockavg"]
    },
    {
      "name": "windowSize",
      "type": "integer",
      "required": true
    },
    {
      "name": "value",
      "type": "number"
    },
    {
      "name": "key",
      "type": "string"
    }
  ],
  "output": [
    {
      "name": "result",
      "type": "number"
    },
    {
      "name": "report",
      "type": "boolean"
    }
  ]
}

Settings

SettingRequiredDescription
functionTrueThe aggregate fuction, currently only average is supported
windowSizeTrueThe window size of the values to aggregate
valueFalseThe value to aggregate

Example

The below example aggregates a 'temperature' attribute with a moving window of size 5:

"id": "aggregate_4",
"name": "Aggregate",
"description": "Simple Aggregator Activity",
"activity": {
  "ref": "github.com/TIBCOSoftware/flogo-contrib/activity/aggregate",
  "input": {
    "function": "average",
    "windowSize": "5"
  },
  "mappings": {
    "input": [
      {
        "type": "assign",
        "value": "temperature",
        "mapTo": "value"
      }
    ]
  }