Validation not working as expected after changing the field name

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

Parents
  • 0
    Certified Senior Developer

    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?  

  • 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 )
    
    
    )
    
    

    ok added the code as you advised,  but expected behaviour is validation should work.

  • 0
    Certified Senior Developer
    in reply to sunus0001
    is validation should work.

    love this answer Grinning 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:

    • regexmatch("helo","Hello") = true
    • regexmatch("h","Hello") = true
    • regexmatch("heli","Hello") = false
    • regexmatch("hal","Hello") =false
Reply
  • 0
    Certified Senior Developer
    in reply to sunus0001
    is validation should work.

    love this answer Grinning 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:

    • regexmatch("helo","Hello") = true
    • regexmatch("h","Hello") = true
    • regexmatch("heli","Hello") = false
    • regexmatch("hal","Hello") =false
Children