Hi everyone ![:) :)]()
I'm new into NAV so maybe my question will seem a bit noob but here it goes.
I created a table which has a field called ID number where user needs to enter a 10-digit integer which represents his/her's ID.
I must create a function that will check if this number is correct by checking if it satisfies following criteria:
If number is ABCDEFGHIJ, then digit J (which is called control digit) must be equal to:
J=13-( 7*(A+G) + 6*(B+H) + 5*(C+I) + 4*(D+J)) MOD 13
and also, needs to satisfy criteria below:
J <= 9 -> X = J
J > 9 -> X = 0
I thought using function FORMAT first to convert integer to string and then COPYSTR for each of local variables A,B,C,D... but it doesn't work![:( :(]()
Can anyone please help me out with correct code?
THANK YOU IN ADVANCE!!!

I'm new into NAV so maybe my question will seem a bit noob but here it goes.
I created a table which has a field called ID number where user needs to enter a 10-digit integer which represents his/her's ID.
I must create a function that will check if this number is correct by checking if it satisfies following criteria:
If number is ABCDEFGHIJ, then digit J (which is called control digit) must be equal to:
J=13-( 7*(A+G) + 6*(B+H) + 5*(C+I) + 4*(D+J)) MOD 13
and also, needs to satisfy criteria below:
J <= 9 -> X = J
J > 9 -> X = 0
I thought using function FORMAT first to convert integer to string and then COPYSTR for each of local variables A,B,C,D... but it doesn't work

Can anyone please help me out with correct code?
THANK YOU IN ADVANCE!!!