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:
and so on.
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 ...
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?
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.
Europe, Middle East and Africa