JMESPath if
H
Henrik Hansen
We need an if function for outputting a textual representation of a value in a metric for output in reports.
An example of this could be to show what billing mode a customer is on, in Acronis (per workload or per gigabyte)
While the metric:
sum(Usages[].usages[?edition ==
pck_per_workload
].value[]) > 0
or
sum(Usages[].usages[?edition ==
pck_per_gigabyte
].value[]) > 0
is returning true or false and this could be used for sorting the billing modes, it would be preferred to do something like:
if(sum(Usages[].usages[?edition ==
pck_per_workload
].value[]) > 0
, Workload
, Gigabyte
)or
sum(Usages[].usages[?edition ==
pck_per_workload
].value[]) > 0
? 'Workload' : 'Gigabyte'and the result would in this case output a string "Workload" as it's true