Checking a Variable Against Another Variable?

Having some minor problem getting the logic right. I've got two variable, theTimeExternal and oldTimeExternal. if they're the same, it means something in my workflow has broken and I want to abort the macro. Despite both values being the same (11:10) the script always reports that they are not the same. What am I getting wrong with the formatting or logic>

This quick replication macro works as expected, generating a "Same" notification:

Example Macro.kmmacros (2.5 KB)
image

So I'm guessing that though the two variables in your macro might look the same, one contains a trailing space or new line or other invisible character that makes them different enough to not be identical. How exactly are you getting the values for these variables? If you can share the full macro, or at least the relevant part if it contains sensitive information, it would make it considerably easier to figure out what might be going wrong.

1 Like

Just pulling them out of a Filemaker database. I'll try truncating them.

Finally got it to work! In the end I truncated both strings to make sure they were the same, and had to use if the variable oldTime contains the other value, then treat it as true. So "is" did not work but "contains" worked fine.

KM also has a Trim Filter action that you may want to apply to both variables before making the compare.