NODE OPERATORS Overview Running a Chainlink Node Fulfilling Requests Run an Ethereum Client Performing System Maintenance Connecting to a Remote Database Configuration Variables Enabling HTTPS Connections Best Security and Operating Practices Best Practices for Nodes on AWS Miscellaneous
ORACLE JOBS Migrating to v2 Jobs Jobs Cron Direct Request Flux Monitor Keeper Off-chain Reporting Webhook Tasks HTTP Bridge JSON Parse CBOR Parse ETH ABI Decode ETH ABI Decode Log ETH ABI Encode ETH Call ETH Tx Multiply Divide Any Mean Median Mode Sum
Mode Task
Accepts multiple numerical inputs and returns the mode (most common) of them. If more than one value occur the maximum number of times, it returns all of them.
Parameters
values
: an array of values from which to select a mode.allowedFaults
(optional): the maximum number of input tasks that can error without the Mode task erroring. If not specified, this value defaults toN - 1
, whereN
is the number of inputs.
Outputs
A map containing two keys:
{
"results": [ ... ], // An array containing all of the values that occurred the maximum number of times
"occurrences": ..., // The number of times those values occurred
}
Example
my_median_task [type="median"
values=<[ $(fetch1), $(fetch2), $(fetch3), $(fetch4), $(fetch5), $(fetch6), $(fetch7), $(fetch8) ]>
allowedFaults=3]
Given a values
array containing [ 2, 5, 2, "foo", "foo" "bar", "foo", 2 ]
, the task will return:
{
"results": [ 2, "foo" ],
"occurrences": 3
}