stevetaylorocs
September 7th, 2006, 09:24 AM
I have an 18 digit number and i need a SQL formula in Crystal Reports to calculate the Luhn digit.
Below is how Luhn is calculated.
Step 1: Double the value of alternate digits beginning with the first right hand digit.
e.g 8 6 3 7 5 = 8 12 3 14 5
Step 2: Add the individual digits compromising the products obtained in Step 1 to each of the unaffected digits in the original number.
e.g 8 12 3 14 5 = 8+1+2+3+1+4+5 (total=24)
Step 3: Subtract the total obtained in Step 2 from the next higher number ending in 0.
e.g 24 = 30-24 = 6 (Luhn = 6!)
Any help here would be fantastic!!
Below is how Luhn is calculated.
Step 1: Double the value of alternate digits beginning with the first right hand digit.
e.g 8 6 3 7 5 = 8 12 3 14 5
Step 2: Add the individual digits compromising the products obtained in Step 1 to each of the unaffected digits in the original number.
e.g 8 12 3 14 5 = 8+1+2+3+1+4+5 (total=24)
Step 3: Subtract the total obtained in Step 2 from the next higher number ending in 0.
e.g 24 = 30-24 = 6 (Luhn = 6!)
Any help here would be fantastic!!