2 Replies Latest reply on Feb 5, 2009 10:14 PM by ralvy

    Multiline Text fields and Numbers

    ralvy

      Title

      Multiline Text fields and Numbers

      Post

      I have a script that takes a series of numbers and inserts them into a multiline text field, one number per line. I can't seem to get those numbers to have 2 decimal places. That is, say I have a list of numbers like this:

       

      194

      23

      456

      65

       

      I'd like it to end up as this:

       

      194.00

      23.00

      456.00

      65.00

       

      I have tried many combinations of SetPrecison and GetAsText, but just can't seem to come up with anything.

        • 1. Re: Multiline Text fields and Numbers
          davidhead
            

          So are the numbers always whole numbers and you just want to add the .00?

           

          If so, you can run a simple Set Field with a Substitute calculation on the field when the numbers are set:

           

             Set Field [ Table::numberlist; Substitute ( Table::numberlist ; ¶ ; ".00¶" ) & ".00" ] 

           

          That will insert the decimal places at the end of each value and at the end of the last one.

           

          Or if you wanted to do it progressively as you added a number to the list, use:

           

             Set Field [ Table::numberlist;  Table::numberlist & ".00" ] 

           

          Now if you have decimal numbers in there and you want to preserve their existing decimal places, that is more complicated. But I will leave that with you just in case this more simple solution works for you. 

          • 2. Re: Multiline Text fields and Numbers
            ralvy
               Thanks, as usual, David. Yes, I do anticipate needing more than just whole numbers on that list. As it turns out, in the last few hours, I decided my needs are more appropriately met by creating another table that holds values (one per record) which I'll see via a portal. This solves all the problems presented by using a multiline text field.