2 Replies Latest reply on Dec 3, 2012 4:52 PM by andresbrewer

    DIsplay leading zeroes in text fields

    andresbrewer

      Title

      DIsplay leading zeroes in text fields

      Post

           I want to display the result of a calculation where the number could be a decimal smaller than 1, i.e. with leading zero, followed by units of measurement (letters). I am not yet able to do this.

           Let's say that I need 1 to 2 oz. of hops to make 20 gallons of beer. The person then wants to make 8 gallons total. I am trying to get the calculated field to display "0.4 to 0.8 oz."

           I tried to make it with merge fields. However, the merge field takes the size of the field name in the layout and disrupts the organization of the other elements.

           I tried making the calculated field produce a number: this does not display the " to " or the " oz."

           I tried making the calculated field produce a text result: does not allow for leading zeros when I look at the inspector.

           What are my options?

        • 1. Re: DIsplay leading zeroes in text fields
          philmodjunk
               

                    However, the merge field takes the size of the field name in the layout and disrupts the organization of the other elements.

               You can put multiple merge fields inside the same block of text. This will enable the text to adjust to correctly display the values when you return to browse mode. As long as the text object does not extend outside the borders of a portal or tab control, that should produce a result that isn't pretty in layout mode but is correct in other modes such as browse or preview.

               You can also select the portion of the merge field option shown in red: <<Table::FieldName>> and select a very small font size and the format specified for the black outer <> brackets will determine what is seen when you return to browse mode.

               Other options:

               If you choose currency as a data format, you can use oz as the currency symbol to show 0.8 oz.

               Your text calcualtion can format and include any leading zero when needed:

               If ( Field1 < 1 ; "0" & Field1; Field1 ) & " to " & If ( field2 < 1 ; "0" & field2 ; Field2 ) & " oz"

          • 2. Re: DIsplay leading zeroes in text fields
            andresbrewer

                 Thank you PhilModJunk for the broad and empowering explanation. The calculated text field solution seems to be the most elegant.

                 In the meantime I was able to subdue the merge field to fit in the table, but it is like a Jack-in-the-box thingy waiting to spread all over the layout!! :-)

                 Thanks again.