Count Errors Loops

Hi,

I need some help. I want to count each loop with an error (for example, the last command made an error), in order to see the ratio of failed over successful loops.

I know !LOOP to count the current value of the loop (and therefore the number of loops made), and i would like something to count the number of loops failed (or successfull)…

Some ideas? :thinking:

Thx! :grin:

Solution: Use a global variable as counter - it keeps its value between loops

Try creating a global variable and using !LastCommandOK or !statusOK with an if statement following the command that you think might make an error.

Example,
“Command”: “store”,“Target”: “0”,“Value”: “error_count”
—line of command with error—
“Command”: “if”,“Target”: “!${!statusOK}”,“Value”: “”
“Command”: “storeEval”,“Target”: “${error_count}+1”,“Value”: “error_count”
“Command”: “echo”,“Target”: “${error_count}”,“Value”: “”
“Command”: “endif”,“Target”: “”,“Value”: “”

1 Like

Great!

Thank you! :smile: