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)
Report heading - Dynamic value
sgeovar
Hi
I have a report which needs a heading . This heading is retrieved from the java class. I have writtent the code in open even
String x = <classname>.getX();
I get the value of x correctly.
How to display this value (X) in the report heading.
I tried with dynamic text, but not working.
Please let me know asto what control I have to use in the report and how to convert this value into the report heading.
Thanks
Find more posts tagged with
Comments
JasonW
How are you getting the value? Can you just call it in the beforeFactory script and set it to a js var?
Like
//do not use var keyword on the variable you want to share
importPackage(Packages.my.package);
var myvarinst = new MyClass();
myvar = myvarinst.getX();
Then use a data item and set its expression to myvar or a text elment set to html and put the value in like:
<value-of>
myvar;
</value-of>
Jason
sgeovar
I'm calling it in Dataset open event.
importPackage(Packages.java.lang);
fileID = blotter.getClientId();
System.out.println(clientId);
SOP prints fileID correctly.
In the report, I put the dynamic text and put this value(fileID).
Report shows only blank. It is not able to get the value of fileID.
Is is possible to set the value of fileID into the report using the dataset open event ?
JasonW
yes but you need to use reportContext.setGlobalVariable("myvar", val);
then in data or text expression use reportContext.getGlobablVariable("myvar");
Jason
sgeovar
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="72140" data-time="1294774424" data-date="11 January 2011 - 12:33 PM"><p>
yes but you need to use reportContext.setGlobalVariable("myvar", val);<br />
then in data or text expression use reportContext.getGlobablVariable("myvar");<br />
<br />
Jason<br /></p></blockquote>
<br />
Thanks Jason. I followed your steps.<br />
But the report shows as "reportContext.getGlobalVariable("clientid")"<br />
<br />
Dateset open event has <br />
myvar = blotterDao.getClientId(); <br />
reportContext.setGlobalVariable("clientid", myvar);<br />
<br />
But the report is not getting it. I used dynamic text. It is printed as "reportContext.getGlobalVariable("clientid")".
sgeovar
reportContext.getGlobalVariable("myVar") is not working with Dynamic Text. Report prints the line as it is reportContext.getGlobalVariable("myVar")
JasonW
Do not use a dynamic text. Either use a data item or a text element. If you use a data item enter the expression like:
reportContext.getGlobalVariable("myvar");
if your using a text element use
<value-of>
reportContext.getGlobalVariable("myvar");
</value-of>
and set the type to html instead of auto.
Jason
sgeovar
I didn't get the values when my data or text item was in between the label
and the table. My report looks like this
LABEL
ITEM
TABLE
When I moved the ITEM to the bottom , I'm able to see the value. But when I put it
in between LABEL and TABLE I'm not able to see it.
JasonW
understood. That is because your dataset has not executed when the first label is generated. You can put a hidden table before it to get the dataset to fire.
Jason
sgeovar
Yes Jason. It got fired.
Thank you very much for your help.