5 Replies Latest reply on Jun 2, 2012 12:46 PM by projay

    No decimal appearing

    projay

      Title

      No decimal appearing

      Post

      I need some help with the following formula.  It is not applying decimal where needed. Should be 1000.00
      Take a look at attached pic.

        "Date: " & $pmtdate & ¶ &
      $pmttype  & " #" & $pmtnumber & " for " & "$" & Let ( [ N =$pmtamount ;
                P = Position ( N ; "." ; 1 ; 1 )
              ];
              Int ( N ) &  If ( P ; Left ( Mod ( N ; 1 ) & "0" ; 3 ) ; ".00" )
            ) & ¶
       & "Payment was applied to the Following Invoices:"

      no_decimal2.jpg

        • 1. Re: No decimal appearing
          philmodjunk

          "Date: " & $pmtdate & ¶ &
          $pmttype  & " #" & $pmtnumber & " for " & "$" &
          Let ( [ N =$pmtamount ;
                    P = Position ( N ; "." ; 1 ; 1 )
                  ];
                  Int ( N ) &  If ( P ; Left ( Mod ( N ; 1 ) & "0" ; 3 ) ; ".00" )
                ) & ¶
           & "Payment was applied to the Following Invoices:"

          Is there any data formatting specified for this field? Check the data tab on the inspector and make sure that it is specified "as entered".

          When I copy and paste

          Let ( [ N =$pmtamount ;
                    P = Position ( N ; "." ; 1 ; 1 )
                  ];
                  Int ( N ) &  If ( P ; Left ( Mod ( N ; 1 ) & "0" ; 3 ) ; ".00" )

          Into a data viewer and substitute different values for $pmtamount, I get the correctly formatted value returned so your calculation appears to be correct.

          • 2. Re: No decimal appearing
            Jade

            As PMJ points out, the variable, $pmtamount, is probably defined as number instead of text.  If so, it's simpler to replace the Let function with:

            SetPrecision($pmtamount, 2)

            • 3. Re: No decimal appearing
              philmodjunk

              it's simpler to replace the Let function with:

              Round($pmtamount, 2)

              Simpler, but doesn't produce the desired results in this context.

              100

              needs to be displayed as

              $100.00

              without using the data formatting option in the inspector (Which I suspect would affect the format of the check number used here.)

              • 4. Re: No decimal appearing
                philmodjunk

                SetPrecision ( 100 ; 2 )

                Still produces a result of 100, not 100.00.

                • 5. Re: No decimal appearing
                  projay

                   I set the data "as entered" so far so good.  Now I just need more checks with a bunch of zeros than I'll know for sure...Getting that check with bunch of zeros may take a while.  I appreciate  all the help.  Thanks a bunch.

                  -J