AnsweredAssumed Answered

Convert Number Code to Letters and process the result

Question asked by Mitch on Oct 24, 2012
Latest reply on Oct 25, 2012 by Mitch


Convert Number Code to Letters and process the result



I am trying to write a script which includes a Loop.  I think a Loop is what is required?


In my database I have one table that has a number of fields,  I one field [Main_Table::Input] is where a user will input a series of characters.  Lets say in this case the user enters the numbers 1234 into this field.


I need the Loop to go to the first character in the field, in this case the number 1, then look up the table for the number 1 in the field [Main_Table::Number] and find the corresponding letter in the field [Main_Table::Letter]  In this case would be the letter A.   


1 = A

2 = B

3 = C

4 = D

5 = E

6 = F



Then the Loop would need to determine the corresponding letter for the second number, third number and so on.  The Loop then stopping when all the corresponding characters have been determined.  


I then need the result of the script to set the field [Main_Table::Result] with the corresponding letters in this case, using the tale below, the result would be ABCD.


Field [Main_Table::Input] can have anywhere between 1 and 100 characters entered.  If the user enters the numbers 2214321313, the reuslt would produce BBADCBACAC,  just as the numbers 21 would produce BA.  


I assume a counter will also be need based on a character count of [Main_Table::Input] to somehow control the Loop?