toInt Expression Question


I’m using the toInt expression to see if the last character of a folder name is a number. It appears to interpret “f” and “n” as 0 and “t” and “y” as 1 (upper and lower case). I’m guessing it interprets those as false / no and true / yes and doing what the user manual suggests it’s doing:

The toInt expression says “if value is a string, it is parsed to see if it represents an integer”.

Is there a way around this or maybe another expression I’m missing?


Hi, Steve!

Luckily, there are only four of them to watch for. The following will give a -1 for anything not ending in 0-9.

switch(lower(right(folderName,1)), 't','f','y','n', -1,-1,-1,-1, toInt(lower(right(folderName,1)),-1) )

Hi Jordan,

Thanks for the reply! I haven’t been receiving notifications on topic posts even though I checked “Notify me when a reply is posted” so didn’t see this until now. I came up with the following using a shared Python script yesterday afternoon:

// toInt expression was returning numbers for "f", "n", "t", "y" so use scripting to check if last character of name is number if(runScript("shared.Helper.is_number", 0, right("{Machine_ID_Code}", 1)), right("{Machine_ID_Code}", 1), "" )

Both solutions seem kind of hacky but at least they work. Thanks again!