cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Iterate through an log record

olgatimbur
Newcomer

I am trying to determine a status of a scenario as passed/failed
| fieldsAdd status = event[steps]
Each step record can have a list of element and results:
example:
[ { "result": "passed", "error": "" },{ "name": "I login to profile", "result": "passed", "error": "" }, ] 
i need to iterate through it, if any of the result is failed, the scenario will get a failed status 
else passed 

Thank you


2 REPLIES 2

Fin_Ubels
Dynatrace Champion
Dynatrace Champion

Hey @olgatimbur 

If all you need is whether or not there is a fail could you use the contains function as below?

fetch logs
| fieldsAdd status = if(contains(content, "\"result\": \"failed\""), "failed", else:"passed")

 

Thank you 

Featured Posts