I have a text field which takes decimal values , i want to restrict(put validation) the field with precision of 22 which means user is allowed to enter 13 digits before decimal and 9 digits after decimal point not more than that . Also, i want to store the value as it is (no round off) .
Please can somebody help me with this .
Thanks in advance.
Discussion posts and replies are publicly visible
You can use regexmatch() to acheive this
I would do an expression rule that receives a text and do the checks making use of the following supporting functions:
split() - to find separate the arrays before and after the decimal point
lenght() to see the number of numbers on each of the arrays returned from split
Then I would stored as a text to make sure you dont lose precision
Hi, Thank you for you response - I am using split function and comparing the length but not sure why appian converts the value into exponential form . How do i retain the original value ?
I created this regex expression but it works untill Appian converts value into exponential form . Is this expected behavior ? or Am i doing something wrong?
I dont know what you are doing as you are only showing the test inputs....
anyways, if you have it with the exponential it means that at some point you are not working with a string, but rather with a number. As well, if the test inputs you might want to write "12.12312" instead of the number directly
We have a function called fixed(). This function has number and decimals(The number of digits after the decimal that will be maintained. 2 by default) fields.
refer documentation here: fixed function
example: fixed(7.36819, 3) returns 7.368
In your case : fixed(ri!enteredValue, 9)
I am facing the similar issue now. Did you manage to solve this problem? Appreciate your response.
You can store this value into a seperate variable by using text function and do the validation on that variable.
Facing similar issue but regex is not working on decimal text field
can you please help me with this?
I tried fixed but not working.
I need my decimal field only takes decimal up to 2 places
What issue you are facing?
© 2023 Appian. All rights reserved.