Hi Appian team,
I have changed the display name for CDT and there for modified the field name in interface as well. I have done the below code change, but the regular expression added for validation is not working as expected.
Can anyone help me out to solve this issue?
below is the code snippet used.
a!textField( label: "Purchase order (PO)/Sales order (SO)/STO/Requisition", labelPosition: "ABOVE", value: trim( index( ri!PF_Request, "Order_Del_Number", null ) ), saveInto: { a!save( ri!PF_Request.Order_Del_Number, /*if(ri!PF_Request.GBEID=18,*/ /*left(*/ /*trim(*/ /*save!value*/ /*),10),*/ /*trim(*/ /*save!value*/ /*))*/ trim(save!value) ) }, required: true, validations:if(ri!PF_Request.GBEID = 18, if(regexmatch("^([0-9]{1,10})$",ri!PF_Request.Order_Del_Number),null,"The number provided should not contain any special character and can have upto 10 digits"), null ) )
Also please see the below discuss link to understand what are the changes I have made.
Thanks
Sunu Sam
https://community.appian.com/discussions/f/process/22377/how-can-i-just-give-a-display-name-to-columns-in-cdt-which-has-a-different-name-in-database-tables-also-i-have-more-questions-regarding-appian-features/87736#87736
Discussion posts and replies are publicly visible
Hi sunus,
1.) please try this function for inserting code. It helps the reader a lot to understand your code
2.) What kind of behavior do you expect?
ok added the code as you advised, but expected behaviour is validation should work.
sunus0001 said:is validation should work.
love this answer but what do you define as " should work". What is the target of your evaluation?I can try to explain the general behavior of regexmatch()if your string ri!pf_request.order_del_number contains all the signs of "^([0-9]{1,10})$" then the return value will be true. If one of them is not included, the returnvalue will be false.simple examples:
I think you can try the following:
if( or( len(ri!PF_Request.Order_Del_Number)>10, len(stripwith(ri!PF_Request.Order_Del_Number,"1234567890"))>0 ), "The number provided should not contain any special character and can have upto 10 digits"), {} )
HI Richard ,
Thanks for the reply
You did not got what am asking for ?
Please go through below link to understand the datatype am using and before changing datatype the same line of code that has regular expression validation has worked.
But now it is not working I want to know reason why that happened and what is the resolution.
thanks
your regex function is working fine for my example (click on the picture and it becomes bigger and more clear)
is your "ri!PF_Request.GBEID = 18" fine?
Hi Richard,
yes you are right problem is not regular expression but the column name change.
In the CDT used, display name is Order_DEL_Number and DB column name is purchaseordernumber. So Issue is that it is not reading the field.
In the earlier discussion with Appian team it is informed that different display name and DB column name for same field in CDT will work fine.
But I am facing the issue that validation is failing.
you can match your DB column name to your CDT parameter name via XSD import/Export?
Did you try that?
Example how a column definition can look like in a XSD
<xsd:element name="role" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="ROLE", columnDefinition="VARCHAR2(12)")</xsd:appinfo> </xsd:annotation> </xsd:element>
ROLE was the name of the DB Column and "role" of the CDT Attribute