Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Calling user defined java script funtion from expression builder
madhavil
Hi every one,
I have a bar chart where some Amount(y-axis) vs Product(x-axis) is displayed. My requirement is to show the amount as tool tip on mouse over on any of the bars. I am able to give the tool tip but, I also need to format this text(amount) as currency.
I need to use the following java script function on the tool tip expression builder:
formatDollar(row["amount"])
function formatDollar(num) {
var p = num.toFixed(0);
var chars = p.split("").reverse();
var newstr = '';
var count = 0;
for (x in chars) {
count++;
if(count%3 == 1 && count != 1) {
newstr = chars[x] + ',' + newstr;
} else {
newstr = chars[x] + newstr;
}
}
return '$'+newstr;
}
Adding this entire code in the builder is not working. I think this function is not called. Please suggest any idea on how to call the function.
Thanks in advance,
Madhavi.
Find more posts tagged with
Comments
kclark
Can you post your rptdesign against the sample db for me to look at?
johnw
If you add your function definition to either the initialize event in the report design, or put it in a seperate .js file and include it in the resource section, it will be available in both Javascript event handlers in expressions.
madhavil
Thanks John for your answer. It solved my problem
I added the function in initialize of report.