Checksum validation

Hello,

I need to create a field validation for entering PESEL (Polish ID number).
Here is basic explanation of checksum:

How can I do this?
Can I do this using just interface or do I need to write code?

Best regards

You should be able to extract the numeric digits as a list using Regex.

Then convert to numbers

Then you can maths the heck out of the list

hi,
thanks for the answer.
but how would you do this?
As Api workflow?

The maths should be simple enough to do it on the page.

Make an input field and create a workflow once the field changes, that updates a state of the input field that’s a list of numbers, made of the digits, then a second state where those digits are multiplied by the required multipliers.

A final state you can do the addition and set it to the value of the checksum

And then if checksum is ok or not, you can format conditionally based on the checksum state

1 Like

Hi,

thanks. It sounds like a solution. But I still don’t get the part with transforming the number into the list.

As far as I understand I need to extract each digit first using regex or truncated and than put them into list of numbers? I’ve tried it:

However it is not working. The list contains only unique numbers.

Really? That’s annoying. I’ll be honest and say I’d have done what you did,
But try nine states… digit1 digit2 etc
And nine more digit1_mult digit2_mult
You only need a place to do your maths

Yeah that’s what I tried yesterday and it’s actually worked. I made field a text (only numbers).
Then I substracted each digit using (truncated from and from end to) and put them to 11 different states. Each result I convertend in number. Then I just made all the math.

Here is example

@richard10 Thank you very much for you help. Without you it would be impossible to me find working solution :slight_smile:

My pleasure! May your Pesels always be pleasingly checksum compliant!