4 Replies Latest reply on Mar 8, 2017 1:34 PM by philmodjunk

    Maintain data format between layouts




      I have a simple script that copies a layout field value (number) into a variable (Set Variable), switches to an unrelated layout and pastes the value from the variable into a global number field. The problem is that if the original value is written as 12.0 the value pasted into the global field is 12 (without the decimal point and zero). All other floats work fine as you would expect but I'd like to retain the number formatting of 12.0 when I move from one layout to the next without removing the decimal point and zero.


      Any help appreciated,





        • 1. Re: Maintain data format between layouts

          1. copy and paste uses the operating systems clipboard so if you can use set variable and set field it would be less prone to problems.

          2. Globals can be accessed from any context so you dont have to go to layout to set them.

          3. If you need to see 12.0 on the layout then use field formatting in the inspector

          • 2. Re: Maintain data format between layouts

            Thanks coherentkris


            I wasn't using copy and paste but Set Variable and Set Field as you suggest. However, I take you point on Globals, i.e. there is no need to use Set Variable and then paste it into a Global field on another layout - I can just use Set Field to set the Global number field to the value held in the original number column before changing layouts.


            Point 3 is the problem. I want the global field to retain the same number and format as the original field from which the value came, e.g. 12.0, 12, 12.345, 12.000 etc .... as far as I can see there is no field formatting option that would allow this. I have tried 'General', 'As Entered' and 'Decimal' and all will remove the decimal place and zero from 12.0

            • 3. Re: Maintain data format between layouts

              12.0 is 12, as far as the nation of numbers knows. If what you mean is 12 and you have fun writing it as 12.000000, it's your problem.


              Let's be serious.


              When you insert a value in a numerical field, you do just that, you can't add formatting-by-typing to it and pretend to transfer it to other fields in other tables.


              If you still want to have fun, define both fields as text and when it really matters use GetAsNumber().

              • 4. Re: Maintain data format between layouts

                12.0 is not the same as 12 in all cases. 12.0 can indicate a measurement recorded with greater precision than 12.


                But how do you get the different formats to start? Are these values in a single field or many? Text field or number?