Back to Geneos FAQ

How to determine if the value in a cell is a number or a string

This demonstrates use of the inList and regMatch functions to check simple use cases to check if a cell has certain numerical values.

For example, if the value is not empty and is in the range of 1 to 10 then set it to OK.

if value unlike "" and inList(value, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10") then
  severity ok
else
  severity warning
endif

For a more advanced check, you could come up with your regex expression for a more precise match the below example will check for pure positive whole numerical values .

Applying the rule block to the column values below will set the severity as shown:

if value unlike "" and regMatch(value, "^0$|^([1-9][0-9]*)$") then
  severity ok
else
  severity warning
endif

Geneos - How to determine if the value in a cell is a number or a string

Please refer to the Rules Action Alerts documentation for details.

Further Information Copied

["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?