4 Replies Latest reply on Jan 18, 2013 7:07 AM by philmodjunk

    Display field data as txt and format

    NetDude

      Title

      Display field data as txt and format

      Post

           I am displaying field data as txt on a layout:

           <<product_percent>>

           The results are: 67.5732197

           How can I format the output as 67.5%

        • 1. Re: Display field data as txt and format
          philmodjunk

               That would be 67.6% in most cases.

               67% is normally stored as 0.67 in a database. Are you sure that it isn't stored in that format?

               If not, you'll need to add a calculation field to your table defined as:

               product_percent/100

               Then you can put this field in place of product_percent on your layout and use data formatting to format the value as a percent. You'll be able to specify the number of decimal places when you do so.

               You might want to modify the original calculation to divide by 100 instead of adding this extra field.

               Note: Merge text such as <<Table::Field>> can be formatted just like a number field but if the layout text that contains this merge field contains other merge fields, the selected data format will be applied to all of them. If one field is a date and one a number, this is not a problem, but it will be a problem if you have two number fields in the same text object and want different data formatting for each.

          • 2. Re: Display field data as txt and format
            NetDude

                 The field <<product_percent>> is calculating by dividing two other fields and multipling by 100 etc. sf_sum / sf_sum_possible * 100 

                 The output result is: 67.5732197

                 I need to calculate the result  only displaying 1 digit to the right of the decimal 

            • 3. Re: Display field data as txt and format
              NetDude

                   I got it - Round ( sf_sum / sf_sum_possible * 100 ; 1 )

              • 4. Re: Display field data as txt and format
                philmodjunk

                     Or you can remove the 100 from your calculation and select both percent data formatting and specify the number of decimal places to display.

                     This is not a trivial difference if you also will use this field in other calcualtions. The rounded and unrounded values can produce different answers. But since you are multiplying by 100, it would seem unlikely that you are using this field in other calculations.