Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Check Digit Calculation

Featured Replies

Well, perhaps this may not tax your left half, but it does mine.

I have a task to produce a check digit from a 20-digit number. I am to use Modulo 10 recursive.

On paper I have created what I think is the right matrix.

Rows:

009468271350

194682713509

246827135098

368271350947

482713509466

527135094685

671350946824

713509468273

835094682712

950946827131

where the first digit is my remainder, the last the check digit.

I am doing it like this (in my head anyway):

Number Example (CNUM): 31356756876567128765

Starting with remainder 0 (Row 1, Index '0'), I take the 1st digit of CNUM; I add 1 to this digit and index the Row to find the next remainder. I use the new remainder to find my next row. I then take the second digit of CNUM, add 1 to it and find my next remainder....and so on. My check digit should be on the 20th recursion of this.

This is all very nice, but I am not really a FMPRO wiz blush.gif" border="0 .

Questions:

1. Is this a reasonable approach?

2. If so, how can I code this in a calculation (fixed 20 digit number)?

3. Is a script better?

Thanks anyone

HOLY FRIGGIN CRAP!

  • Author

I'll take that as a don't know then shall I?

As for modulo 10 recursive, I've never heard of it before, so I'll take your word for it that your method is correct.

You could do it as one calculation but it would be really ugly. If you use a script, you would have to run it everytime you change the value of CNUM.

I would probably do it with several (20) calculated fields to hold intermediate results, and the final one to hold the final answer.

Put the entire matrix into a global text field called "matrix" with a space between each row. That way you can retrieve a row using the MiddleWords function, and the number in the row with the Middle function. Then do an intermediate calculation for each remainder. For example, your calculation for Remainder15 would be:

Remainder15 = TextToNum(Middle(MiddleWords(matrix, Remainder14, 1), TextToNum(Middle(CNUM,15,1)+1), 1))

These calculations will be virtually identical, so you can replicate all 20 of them quickly.

  • Author

Thanks. Great help.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.