Home
Intelligence (Analytics)
Formating Number inside data element
Avdhesh
Hello.
I'm constructing following content in data element. I would like to format row["PRBRT"] with something like format="$#,###.##". Is it possible inside dataelent? Please advise.
Thanks,
Avdhesh
reportContext.getMessage("ESTIMATED_BASE_PAY_BASED_ON_AN_ANNUAL_RATE_OF", reportContext.getLocale()) + ": $" + row["PRBRT"] +" / " + row["PRBRTF_STR"]
Find more posts tagged with
Comments
mwilliams
Do you mean rather than using the formatNumber section of the property editor?
Avdhesh
Hello,
How can I format the number coming from database (row["PRBRT"]) so the number is displayed with 1000 separater
reportContext.getMessage("ESTIMATED_BASE_PAY_BASED_ON_AN_ANNUAL_RATE_OF", reportContext.getLocale()) + ": $" + row["PRBRT"] +" / " + row["PRBRTF_STR"]
Currently it is shown as :
Estimated Base Pay based on an annual rate of: $180000 / Annual
Would like to show:
Estimated Base Pay based on an annual rate of: $18,0000 / Annual
Thanks for your help.
Avdhesh
Avdhesh
Thanks for your reply.
I can't use property editor as I'm constructing the contents with string inside data element.
mwilliams
Hi Avdhesh,
You should be able to use the number format section of the property editor to do this. Or are you wanting to do it programatically? If so, you can set the number format in script by doing this.getStyle().numberFormat = "formatString" in your onCreate script for you element.
Avdhesh
Hi Michael,
Thanks for your reply.
I want to do programatically.
Here is the string I'm constructing programatically and formating should be applied to row["PRBRT"] only as row["PRBRT"] is decimal value.
reportContext.getMessage("ESTIMATED_BASE_PAY_BASED_ON_AN_ANNUAL_RATE_OF", reportContext.getLocale()) + ": $" + row["PRBRT"] +" / " + row["PRBRTF_STR"]
I would like to somethink like that...
row["PRBRT"].getStyle().numberFormat =#,##0.00;
reportContext.getMessage("ESTIMATED_BASE_PAY_BASED_ON_AN_ANNUAL_RATE_OF", reportContext.getLocale()) + ": $" + row["PRBRT"] + " / " + row["PRBRTF_STR"];
Any suggestion?
Thanks,
Avdhesh
mwilliams
Try something like this in an HTML type text control:
<VALUE-OF format="#,##0.00">row["ORDERNUMBER"]</VALUE-OF> the rest of the string
For your "the rest of the string" part, you'll probably need to use another value-of tag to grab all of your report context stuff.
Hope this helps.
Avdhesh
Thanks Michael. Really works out well when I converted Data Element to HTML Control.
However, I've similar requirement in Pie chart. I'm showing a tooltip over "Mouse Over" event. How can I format row["Amount"] inside Tooltip Expression Builder?
row["CompComponent"] + "- $" + Math.round(row["Amount"]);
mwilliams
What did the above do for you?
Avdhesh
I'm constructing row["CompComponent"] + "- $" + Math.round(row["Amount"]); inside tooltip over "Mouse Over" event
Currently Tooltip inside Pie Chart Shows "Salary - $12000"
I would like to show "Salary - $120,00.00"
<VALUE-OF format="#,##0.00"> only works for HTMl control so I can't use here.
Any suggestion?