
1. Re: Calculation to substitute the numbers
jbante Mar 15, 2012 11:22 AM (in response to olgagutten)Can you show us the calculation you tried?

2. Re: Calculation to substitute the numbers
comment Mar 15, 2012 12:20 PM (in response to olgagutten)olgagutten wrote:
I have already tried to do the custom function: to sort the numbers in ascending order
I don't think you need to sort at all. Try =
2 * Mod ( number ; 10 ) +
3 * Mod ( Div ( number ; 10 ) ; 10 ) +
4 * Mod ( Div ( number ; 10^2 ) ; 10 ) +
5 * Mod ( Div ( number ; 10^3 ) ; 10 ) +
6 * Mod ( Div ( number ; 10^4 ) ; 10 ) +
7 * Mod ( Div ( number ; 10^5 ) ; 10 ) +
8 * Mod ( Div ( number ; 10^6 ) ; 10 ) +
9 * Mod ( Div ( number ; 10^7 ) ; 10 )
Or you could use a custom function to iterate over the digits.

3. Re: Calculation to substitute the numbers
raybaudi Mar 15, 2012 12:48 PM (in response to olgagutten)Instead of a custom function, you could:
1) create a repeating calculation field ( cRep ) with 8 repeatitions and with calc:
( Get ( CalculationRepetitionNumber ) + 1 ) * Mod ( Div ( Extend ( number ) ; 10 ^ ( Get ( CalculationRepetitionNumber )  1 ) ) ; 10 )
2) create a result ( total ) calculation field:
Sum ( cRep )
Note that:
the cRep calculation field do not need to stay on the layout
A 8 digit number will return a result with: 0 ≤ result ≤ 396

4. Re: Calculation to substitute the numbers
olgagutten Mar 16, 2012 3:38 AM (in response to olgagutten)Hello Guys,
Thank you for your posts. None of these formulas are working properly.
For Example I have this number: 11119876, Using this formula:
2 * Mod ( number ; 10 ) +
3 * Mod ( Div ( number ; 10 ) ; 10 ) +
4 * Mod ( Div ( number ; 10^2 ) ; 10 ) +
5 * Mod ( Div ( number ; 10^3 ) ; 10 ) +
6 * Mod ( Div ( number ; 10^4 ) ; 10 ) +
7 * Mod ( Div ( number ; 10^5 ) ; 10 ) +
8 * Mod ( Div ( number ; 10^6 ) ; 10 ) +
9 * Mod ( Div ( number ; 10^7 ) ; 10 )
I am getting result : 140 which is wrong, where the number must be: 543272644936this is if you read from right to left, the first min number would be 1, it needs to be multiplied by 2, so result is 2;
the next it starts reading from right to left again omitting that first result, the next min number is 1 again, multiplied by 3, so result is 3;
the next it starts reading from right to left again, omitting the second result which is now 3, the next min number is then 1 again, multiplied by 4 now, so result is 4; and so on.
In the second formula: the result is : 12, it means it takes the first number from left to right and mulitplies it by 2 and does not go any further. . .
Instead of a custom function, you could:
1) create a repeating calculation field ( cRep ) with 8 repeatitions and with calc:
( Get ( CalculationRepetitionNumber ) + 1 ) * Mod ( Div ( Extend ( number ) ; 10 ^ ( Get ( CalculationRepetitionNumber )  1 ) ) ; 10 )
2) create a result ( total ) calculation field:
Sum ( cRep )
Note that:
the cRep calculation field do not need to stay on the layout
A 8 digit number will return a result with: 0 ≤ result ≤ 396

5. Re: Calculation to substitute the numbers
comment Mar 16, 2012 3:58 AM (in response to olgagutten)olgagutten wrote:
For Example I have this number: 11119876,
if you read from right to left, the first min number would be 1, it needs to be multiplied by 2,
I am afraid you may be confusing between "least significant" and "smallest". In your example, the least significant digit is 6, because it represents the value of 9 at most. The digit 1 you are referring to (the one immediately to the left of 9) stands for a value of 10,000  and could go as high as 90,000.
Perhaps you could point us to the source of your algorithm. To me, it seems like you are trying to calculate a checksum?

6. Re: Calculation to substitute the numbers
jason.delooze Mar 16, 2012 6:39 AM (in response to comment)I agree, Michael, that it looks similar to the checkdigit algorithm used in the old ISBN or a vehicle VIN. The source of the algorithm would be helpful.

7. Re: Calculation to substitute the numbers
olgagutten Mar 16, 2012 8:01 AM (in response to jason.delooze)Yes, Michael. It is a check digit formula, I have got it wrong myself initially. Do you have any proper examples, I need to figure out modulus 19 on check digit. It is like and ISBN.

8. Re: Calculation to substitute the numbers
olgagutten Mar 16, 2012 8:06 AM (in response to comment)This is working great now. You are genious Michael. Thank you very very much!!!!

9. Re: Calculation to substitute the numbers
jason.delooze Mar 16, 2012 8:37 AM (in response to olgagutten)Is it the new ISBN (13 digits) or the old ISBN (10 digits)? The old ISBN was MOD 11 and the new ISBN is MOD 10. You need to give us the algorithm.

10. Re: Calculation to substitute the numbers
olgagutten Mar 26, 2012 6:22 AM (in response to jason.delooze)Dear All,
I have solved the algorithm in number of steps. I will describe it here, but I am looking for more elegant and short way using for example Let function of Recursive function. The purpose is to input into one calculation instead of 5, or at least into 2 calculations.
I have alphanumeric number FDXC5647K
1. Each alpha character is converted into a number according to the position in alphabet, for example:
Substitute(Middle ( number; 1 ; 3);
["A";101];
["B";102];
["C";103];
["D";104];
["E";105];
["F";106];
["G";107];
["H";108];
["I";109];
["J";110];
["K";111];
["L";112];
["M";113];
["N";114];
["O";115];
["P";116];
["Q";117];
["R";118];
["S";119];
["T";120];
["U";121];
["V";122];
["W";123];
["X";124];
["Y";125];
["Z";126])  This is currently done 4 times to get separate results of each conversion of FDXC5647K
2. The result of each convertion is then miltiplied by 9, next result is by 8 etc. untill and the rest 4 digits of the initial number is multiplied by: FDXC5647K  5 by 5, 6 by 4, 4 by 3 and 7 by 2.
3. All of this are then totaled and modulus of 13 is found.
I had to create 4 separate calculation fields to convert those 4 initial characters.
4. To get total result I had to do the following:
Middle (number;10; 1) * 2+
Middle(number;9; 1) * 3+
Middle(number;8; 1) * 4 +
Middle(number;7; 1 ) * 5+
number_one * 6+
number_two 3 * 7+
number_three * 8+
number_four * 9)
where number_one, number_two, number_three and number_four are those separate calculation results with first conversions.
numberis an input field for FDXC5647K
The modulus is then found from the total which I have no problem with.

11. Re: Calculation to substitute the numbers
comment Mar 26, 2012 5:08 AM (in response to olgagutten)I have lost you at step 2. Please provide a workedout example. Note that "first", "second", etc. depend on the direction you have chosen.

12. Re: Calculation to substitute the numbers
comment Mar 26, 2012 5:37 AM (in response to olgagutten)Header 1 Header 2 Header 3 Header 4 F 106 9 954 D 104 8 832 X 124 7 868 C 103 6 618 5 5 5 25 6 6 4 24 4 4 3 12 7 7 2 14 K 111 1 111 Sum ( ) = 3458 ;
Mod ( 3458 ; 19 ) = 0
Is this the correct method?

13. Re: Calculation to substitute the numbers
olgagutten Mar 26, 2012 6:21 AM (in response to comment)This is right, exept K is a check character.

14. Re: Calculation to substitute the numbers
comment Mar 26, 2012 6:31 AM (in response to olgagutten)olgagutten wrote:
exept K is a check character.
Not sure what this means in terms of the required process.