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)
Chart Y-Series - Invoke Script
cypherdj
Hello,
I'm invoking client-side script from a chart, and this works absolutely fine in most of the scenario I'm trying to support.
However, there is one chart I'm finding a bit more problematic.
Basically, when I go into the expression editor (Y-series -> Interactivity -> Invoke Script), I cannot pick any column from my data set to use into the expression, only the category data, value data and value series name.
I've tried to use <b>dataSetRow["MYCOLUMN"]</b> in this expression, but I'm getting a script error at runtime.
Is there any way to achieve this with BIRT 2.2?
Regards,
Cedric
Find more posts tagged with
Comments
bhanley
I do not think you are going to be able to get to any data that are not explicitly bound to the chart in that spot. It is an issue of scope. Do you need access to an additional column for each data set row or just some other value outside the scope of the chart? Perhaps you can store some critical value in a global variable?
cypherdj
Hi Brian,
Basically, the categoryData is a date, but I cannot find a way to format it.
I tried the following, which usually works in scripting:
{code}
importPackage(Packages.java.text);
sdf = new SimpleDateFormat("dd/MM/yyyy");
reportDate = sdf.format(categoryData);
alert(reportDate);
{/code}
But at runtime, this throws an error.
So I was thinking about adding a computed column to my data set, perform the formatting in there, and rather than pass categoryData, I would pass this computed column. But if I cant access the data set, that rules it out.
When I simply output categoryData, it displays the full date as "Fri Jun 11 00:00:00 BST 2010".
I could address this issue by enforcing that this date format is used at the other end, so probably can work around this issue.
However, for another chart, the categoryData is again a date, but on click of the bar, I'd like to pass 2 other fields from the dataset. Those values are driving the actual legend label, so I could potentially pipe them into a computed column and use this as the series value name.
But if there was a way to get to the data set row, it would make my life a lot easier than having to parse this piped value