Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (5.3k points)

I have a problem where I need to have some exception handling for some data that I will put into a excel report. The DataItem "Personal Identity Code" can be invalid; It must always be 11 characters long and its format should be DDMMYYSNNNX, where DD = day, MM = month, YY = year, S = Either ‘A’ or ‘-‘, NNN = number, X = Letter or number Examples: 310199-111K, 011206A2222

I want to somehow check this / validate the format before it will be processed from the queue (so I can throw an Business Exception). Is there some clever way to set this up? I was thinking about maybe a regex in combination with something?

Edit:

This is how my process page look like with the solution: enter image description here

1 Answer

0 votes
by (9.5k points)

To validate that kind of input I'd do two validations:

a) regex to check if it matches the expected format

Example regex could be this one:

\d{6}[A-]\d{3}[\d,a-z,A-Z]

B) check if date at the start of the string is valid (e.g. no 30th of February, or 95th of 25th month).

I'd try to use calculation stage MakeDate() function in combination with Left() and Mid() functions. If the date is incorrect, then the BluePrism will throw an error "Unable to convert the 3 supplied parameters to a date"

  

Related questions

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...