SAP Builders Discussions
Join the discussion -- ask questions and discuss how you and fellow SAP Builders are using SAP Build, SAP Build Apps, SAP Build Process Automation, and SAP Build Work Zone.
cancel
Showing results for 
Search instead for 
Did you mean: 

validate an input field in SAP Build Apps.

YashminBehera
Explorer
0 Kudos
231

Hi SAP Community,

I'm currently working on something that involves creating payment options in SAP Build Apps. For the credit card option, I need to ensure that users enter a 12-digit card number. I am looking for a formula that can validate this input field whenever the app is previewed.

Specifically, if the user does not enter a 12-digit number, an alert should be raised with the message: "Please enter a 12-digit number."

I would greatly appreciate any guidance or examples of formulas that can achieve this validation. Thank you in advance for your support!

Best regards, 

Yashmin Behera

SAP Community 

SAP Build Apps 

@Dan_Wroblewski 

@kleventcov 

 

4 REPLIES 4

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos
177

Use formula like this:

 

IF(MATCHES_REGEX("1234567890123a", "^[0-9]{12}$"),"MATCH","BOOOOOOOOOOOO!")

 

 Obviously, replaces the "123..." string with your variable.

P.S.: Thanks, ChatGPT 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

0 Kudos
129

Hi @Dan_Wroblewski 

I am still unable to achieve the same.

YashminBehera_0-1734514301823.png

 

0 Kudos
125

The error message explains the issue.

i assume you have an IF flow function, so you just need to return Boolean. You just need the MATCH_REGEX without the IF function




--------------
See all my blogs and connect with me on Twitter / LinkedIn

0 Kudos
113

Thank you @Dan_Wroblewski 
Got it.😊