Numerical Evaluation Macro (v10.2)

Numerical Evaluation Macro (v10.2)

Numerical Evaluation.kmmacros (6.7 KB)

I require an evaluation based on numerical values that isn't working so I'm presuming KM isn't evaluating the equalities numerically but rather as string/text.

I searched the available options but it doesn't look like any mathematical functions or features exist in the Library. What's the best way to approach forcing a numerical evaluation of string data to make this work?

This macro example should return True but instead it returns False.

I don't believe your OR is supported. Try adding separate conditions for each of them under the any of the following statement.

1 Like

I think you may be using the wrong actions – you need Set variable to Calculation actions.

KM values are always stored as strings, but you can perform numerical evaluations using CALC functions and Set value to Calculation actions.

See: manual:Calculations [Keyboard Maestro Wiki]

If you do ever want to evaluate a numeric expression inside a TEXT field (rather than a CALC) field, then you need to use a %Calculate%<expression>% token.

token:Calculate [Keyboard Maestro Wiki]

Thanks for pointing that out and I believe you may be right except for some reason it seemed to evaluate properly with the exception of the string vs number issue. I'm on the fence about it b/c according to the Wiki documentation it appears to be supported.

I just can't determine the way the documentation is constructed if its stating to use | or the string "OR"
Maybe both are supported?

Calculations / Operators

Nonetheless I did change it after considering your post and changed my OR to | instead.

Thanks for the tip!

Thanks, that fixed the issue. Newbie learning curve. :face_exhaling:

1 Like