4 Replies Latest reply on Jun 11, 2012 11:28 AM by philmodjunk

    keeping a decimal point to 2 characters

    dangeruss

      Title

      keeping a decimal point to 2 characters

      Post

      eg $12.95 instead of $12.9555555555555 need to know the calculated script to make this not go beyond 2 decimal points.

      6-11-2012_12-59-50_PM.jpg

        • 1. Re: keeping a decimal point to 2 characters
          dangeruss

          the calculated funtion i'm guessing needs to go in this field...

          • 2. Re: keeping a decimal point to 2 characters
            philmodjunk

            Is this table or list view in your example?

            If table view, enter layout mode and make sure that the number field is actually present on your layout so you can give it a data format.

            You can use the field tool to add it to the layout if it's not there when you select layout mode.

            Use data formatting on the Inspector's data tab to specify currency with two decimal places and 12.955555555555 will then be displayed as $12.96.

            Note that the value should, in any case I can think of, round to 6, not 5 in the penny column. If you really need to simply truncate the extra digits, you'll need to use a calculation field to do it.

            • 3. Re: keeping a decimal point to 2 characters
              dangeruss

              all the data options are entered correctly. this has to do with the calculated value to display right. and i just need to know what option to put in there: case function floor function, etc 

               

              this is what the php code says from the backend but i know you should be able to set a calculated value instead of going thru the backend to fix...

              <td class="browse_cell right">
                                                          <?php echo nl2br( $record->getField('Asking Price', 0) )?> </td>
              • 4. Re: keeping a decimal point to 2 characters
                philmodjunk

                For just using Filemaker, not publishing to the web, those are the correct settings. IF you are using custom web publishing with PHP to publish to the web, you'll need to either figure out the php code to format your data--not something that I can do or define a calculation field that properly rounds and formats your data.

                Something like:

                "$" & int ( Numberfield ) & "." & Left ( Filter ( Mod ( Round ( Numberfield ; 2 ) ; 1 ) ; 9876543210 ) & "00" ; 2 )