Is it possible to use "RIGHT" function in calculate

Hi
Just wondering if there is an equivalent to excel’s RIGHT function inside Kobo/xlsForms?
I want to extract the last 2 digits of a number entered by the user so that I can then use it further down the form in a concat calculation.
I can ask the user to enter only the last 2 digits of the number if necessary - but its might cause some problems, soI am wondering if this function exists as it would make it more straight forward

Basically I am wondering if there is a kobo equivalent of
=RIGHT(${x},2)

thanks

Welcome,
You may use the mod operator. AnyNumber mod 100 should give you the last 2 digits.

For existing functions and operators you can always look here
https://getodk.github.io/xforms-spec/#xpath-functions

2 Likes

@the_barn8, this is how @wroos has advised you to do it:

Thank you @wroos for sharing this with the community!

ok great thanks for the example and the clarification on the calculation. That’s really helpful.
Thanks also @wroos for the solution.

1 Like

Right returns the last character or characters in a text string, based on the number of characters you specify . RIGHTB returns the last character or characters in a text string, based on the number of bytes you specify. Important:These functions may not be available in all languages.