4 Replies Latest reply on Aug 25, 2010 10:42 AM by George_Johnson

    Custom Dollar Format


      I'm trying to create a custom format for currency within a PDF. 


      Currently I have a column of currency that looks like this:







      and so on.


      What I'm trying to accomplish is to right justify the currency column, but have blanks when the currency isn't at its fullest point.


      Here is what im looking for:



      $   123.45


      $     12.34


      and so on.


      Any ideas?



        • 1. Re: Custom Dollar Format
          warzenbeisser Level 1

          You'll probably have to code some elaborate logic for the variable space of "unoccupied" figures and commas. Why not position the dollar sign and the amount separately instead of creating a custom format? However, the problem of figuring out the width of the biggest amount before you are able to determine position coordinates remains ...

          • 2. Re: Custom Dollar Format
            gkaiseril MVP & Adobe Community Professional

            Have you tired setting the alignment of the field data to 'Right'?


            Since the numeric field usually does not have a defined length, how will you know how many leading spaces to provide?

            • 3. Re: Custom Dollar Format
              techie33 Level 1

              What about this logic?


              Seperate the field into 2 columns, one just for the dollar sign, the other for the dollar amount.


              If an amount is input into the dollar amount field, populate the dollar sign field with a dollar sign.


              I think this logic would work, but could anyone help me with the code?



              • 4. Re: Custom Dollar Format
                George_Johnson MVP & Adobe Community Professional

                I think that's a good idea. You could then use code like the following as the custom Validate script of the amount fields:


                // Show the corresponding dollar sign if the value is not blank

                getField("dollarsign1").display = event.value ? display.visible : display.hidden;




                // Show the corresponding dollar sign if the value is not zero or blank

                getField("dollarsign1").display = +event.value ? display.visible : display.hidden;


                You should set up the dollar sign fields so they are read-only and the default value is set to "$".


                In the first script, is will display the dollar sign if there is any numeric value in the field, including "0". Only if the field is blank will the dollar sign not show.


                In the second script, the dollar sign will not show if the field is blank or equal to zero.