How to mask a num value?

Hi,

I have a number of 104 (example, changes depeding on what the number I get from the PLC is). I would like to read the two last digits of 104 (04) and read that into a new num, is this possible in RAPID? Shearched but can’t find anything regarding that.

Best regards,

Alexander K

Hi Alexander,

Try this:

m = your original integer

n = the two last digits

n = m - Trunc(m / 100) * 100

Example:

m = 1234

m / 100 = 1234 / 100 = 12.34

Trunc(m / 100) = Trunc(12.34) = 12

Trunc(m / 100) * 100 = 12 * 100 = 1200

n = m - Trunc(m / 100) * 100 = 1234 - 1200 = 34

Disclaimer: This algorithm was not tested in RAPID and needs to be validated before put into production.

Or something like this

Thank you very much, need to put me into the above examples, I’m not a math genius, but I don’t think it will be a problem, else I will bother the two of you again :laughing:

Best regards,

Alexander K