MaxList
Gets the maximum value from list e.g. ["25", "10", "25"] => "25".
python · Community Common Scripts
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def max_value(value): if isinstance(value, float): return value if isinstance(value, str): try: value = [float(item) for item in value.split(",")] except ValueError: return "error", "error" elif isinstance(value, list): try: value = [float(item) for item in value] except ValueError: return "error", "error" result = max(value) return result, "ok" def main(): value = demisto.args()["value"] result, return_type = max_value(value) if return_type == "error": return_error("This transformer applies only to list of numbers.") demisto.results(result) # python2 uses __builtin__ python3 uses builtins if __name__ in ["__builtin__", "builtins"]: main()
README
Gets the maximum value from list
e.g. [“25”, “10”, “25”] => “25”
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | transformer, number, entirelist |
Inputs
| Argument Name | Description |
|---|---|
| value | A list for which to sum the list values. |
Outputs
There are no outputs for this script.