2 Replies Latest reply on Jul 16, 2014 12:40 PM by KellyFisher

    Copying each digit from a value and paste on another fields

    marciotky

      Title

      Copying each digit from a value and paste on another fields

      Post


           Hey All,

            

           Newbie here. My problem is that I have a total amount (sales) but need to get each digit from that value and copy it to separate fields, one by one. (It is generate from another table with a script button)

           E.g

           Total Sales: ¥25,000 (the value could change from 4 ~ 6 digits)

           Field A: 2

           Field B: 5

           Field C: 0

           Field D: 0

           Field E: 0
            

           I think the solution is the middle, left or right function with the position function. But couldn't find a perfect solution. Any ideas?

            

           Thanks

            

        • 1. Re: Copying each digit from a value and paste on another fields
          philmodjunk

               Why do you need to do this? This seems a very odd thing to do.

               Middle ( amountField ; 1 ; 1 ) will return the first digit
               Middle ( amountField ; 2 ; 1 ) will return the second and so on.

               IF there are other characters in the field, you can use the filter function to just get the numeric digits and a decimal separator.

          • 2. Re: Copying each digit from a value and paste on another fields
            KellyFisher

                 I am trying this exact same thing.  When I do it, it is close.  Except the number position changes.  For example is the number 54321, then

                   
            •           Field1 should be 1
            •      
            •           Field2 should be 2
            •      
            •           Field3 should be 3
            •      
            •           Field4 should be 4
            •      
            •           Field5 should be 5

                 But it's showing up like

                   
            •           Field1 is 5
            •      
            •           Field2 is 4
            •      
            •           Field3 is 3
            •      
            •           Field4 is 2
            •      
            •           Field5 is 1

                 Seems like then I just have it in reverse. However, if it is only 4 digits (4321), everything moves up a spot

                   
            •           Field1 is 4
            •      
            •           Field2 is 3
            •      
            •           Field3 is 2
            •      
            •           Field4 is 1
            •      
            •           Field5 is blank.

                 I assume it's reading the position left to right and I am needing it to read right to left. How do I change that?