Generate number

Good evening to everyone. I want to generate a code based on a number. In the provided picture, column A contains integers, column B represents the sum of specific digits in column A (i.e., =MID(A2;2;1)+MID(A2;4;1)+MID(A2;6;1)+MID(A2;8;1)+MID(A2;10;1)+MID(A2;12;1) which includes the second, fourth, sixth, and so on), column C represents the sum of other specific digits in column A (i.e., =MID(A2;1;1)+MID(A2;3;1)+MID(A2;5;1)+MID(A2;7;1)+MID(A2;9;1)+MID(A2;11;1) which includes the first, third, fifth, and so on). Column D is calculated as =(B23)+C2, column E as =D2/10, column F as =ROUND(E2;0), and column G as =F210. Finally, column H is calculated as =IF(G2-D2>0;G2-D2;10+(G2-D2)). After these calculations, the final code will be 1234567890128. Basically, the calculations will be as follows: A column: 123456789012 B column: 2+4+6+8+0+2=22 C column: 1+3+5+7+9+1=26 D column: (22 * 3) + 26 = 92 E column: 92/10 = 9.2 (rounded to 9) G column: 9 * 10 = 90 H column: 90 – 92 = -2. Since it is a lower number, we add +10. -2 + 10 = 8 The final number is 1234567890128. Based on the given formulation, I need assistance in creating a code that generates numbers for a product. Whenever I click on the generate button, it should continue from the next number (e.g., 123456789013, 123456789014), and calculate the final code for each generated number. Can someone help me create this code?
1 answers

Based on your screenshot I’d say you could take your last code and add 7.

Maybe that doesn’t work. You seem to know what the ‘algorithm’ is. Maybe use the java action StringSplit in CommunityCommons on your Number. If you use '' (empty string) as split parameter you’ll get a list of SplitItems with an index (starting with 0) and a value (one digit). If you loop over them, you can add the value to a “ColumnB” or “ColomnC” integer variable based on whether the index is odd or even. Then do the rest of your calculations.