Expand my Community achievements bar.

SOLVED

Help converting a number to ones position only

Avatar

Level 2

Hello,

 

I am stumped. I need to be able to convert a number to its ones value only. For example: if someone enters 65, I need it to return only the 5. Another example: 87 returns only the 7, etc. There will be no decimal numbers.

 

Any idea how I could accomplish this?

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The below script will give you the desired data.

var yourFieldValue = yourField.rawValue;
var convertedValue = yourFieldValue.toString().substr(-1);

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

The below script will give you the desired data.

var yourFieldValue = yourField.rawValue;
var convertedValue = yourFieldValue.toString().substr(-1);

Avatar

Level 2

Wow thank you Vijay. It's embarrassing when the answer is literally two lines