Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
Hi! Just wanna ask how can I make the text file only accept values that are in this format
1.1.1
1.2.2
etc
Discussion posts and replies are publicly visible
You can use regex functions to match with specific text pattern and use its result for displaying validation on the text field.
{ a!textField( label: "Release Version", labelPosition: "ABOVE", value: ri!value, saveInto: { ri!value }, refreshAfter: "UNFOCUS", validations: { if( regexmatch( "^(\d+\.)(\d+\.)(\*|\d+)$", ri!value ), {}, "Enter correct format XX.XX.XX" ) } ) }
Use this web based tool to explain / understand the regex pattern - https://regexr.com/
Thank you very much! worked perfectly!
can you please help me with how can we apply validations on the decimal field
In the decimal field accept values up to 2 decimal places only.
I tried with fixed function but it's not working
fixed(ri!record.amout,2)
For validation, you can use the below code.
a!localVariables( local!dec, a!floatingPointField( label: "Decimal Number", value: local!dec, saveInto: local!dec, validations: if( a!isNullOrEmpty(local!dec), {}, if( regexmatch( "^\-?[0-9]+(?:\.[0-9]{1,2})?$", todecimal(local!dec) ), {}, "Error" ) ) ) )
You are on the right track . Just need one more condition. Check the below code.
if( ri!value = todecimal(fixed(ri!value, 2)), {}, "Invalid value" )
hey Harshit
Thanks for the quick reply but it is not working
I am using this way in the validations expression editor of the decimal field
if( ri!record.totalAmount = todecimal(fixed(ri!record.totalAmount, 2)), {}, "Invalid value" )
getting this error
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'fixed' [line 56]: A null parameter has been passed as parameter 1
We're missing a null check here. See this updated code.
if( or( a!isNullOrEmpty(ri!record.totalAmount), ri!record.totalAmount = todecimal(fixed(ri!record.totalAmount, 2)) ), {}, "Invalid value" )
It's working fine nowThanks for the help :)