Hai Friends,
I need to find the verification digit to the following value: 3070841326319000361243033388633240620117 (Length - 39 char)
Logic for finding the Verification Digit:
1. Sum odd positions [3, 7, 8, 1, 2, 3, 9, 0, 3, 1, 4, 0, 3, 8, 6, 3, 4, 6, 0, 1]. (SumOdd = 72)
2. Multiply SumOdd * 3. (Mult = 72 * 3 = 216)
3. Sum even positions [0, 0, 4, 3, 6, 1, 0, 0, 6, 2, 3, 3, 3, 8, 3, 2, 0, 2, 1]. (SumEven = 47)
4. Sum = Mult + SumEven, (Sum = 216 + 47 = 263)
5. Verification digit 7. (We need to add the integer value 7 to 263 so the nearest higher value which should divisible by 10 and the remainder remains 0.)
To find the lowest number (verification digit):
VeriDigit = 10 - (Sum - (int(Sum/10) * 10))
VeriDigit = 10 - (263 -(int(263/10) * 10))
VeriDigit = 10 - (263 - (26 * 10))
VeriDigit = 10 - (263 - 260) = 10 - 3
VeriDigit = 7 (Answer)
Can anyone please help me in solving this in NAV?
Thanks in advance.
0
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Ptxt_String = 3070841326319000361243033388633240620117 (39 char)
Ltxt_resultstring, Ltxt_resultstringO, Ptxt_String are text varialbles and others are integer variables
[0, 0, 4, 3, 6, 1, 0, 0, 6, 2, 3, 3, 3, 8, 3, 2, 0, 2, 1,7]
Here Sum is 54 Here Sum = 216 + 54 = 270
[/quote]
Try this code
Where Ltxt_resultstring and Ltxt_resultstringO also integers..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Sorry I missed to delete the last character in the given value. Yeah I will try with your code and let know about the result. Thanks you very much for your effort.
MBerger,
STRCHECKSUM function worked for me. Thank you very much. Let me try with Mohana's modified code too.
Thanks.