Skip navigation
techie33
Currently Being Moderated

Custom Dollar Format

Aug 25, 2010 5:47 AM

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

 

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

 

$1,234.56

$123.45

$1,234.56

$12.34

$1,234.56

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:

 

$1,234.56

$   123.45

$1,234.56

$     12.34

 

and so on.

 

Any ideas?

 

Thanks

 
Replies
  • Currently Being Moderated
    Aug 25, 2010 7:50 AM   in reply to techie33

    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 ...

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 25, 2010 8:00 AM   in reply to techie33

    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?

     
    |
    Mark as:
  • George Johnson
    11,676 posts
    Aug 11, 2002
    Currently Being Moderated
    Aug 25, 2010 10:42 AM   in reply to techie33

    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;

     

    -OR-

     

    // 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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points