Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
HTML for Text Item from database
Dakmen
Hello
Please help with using setPersistentGlobalVariable in Fetch method and
getPersistentGlobalVariable in OnCreate Method
Task is simple. In database is saved HTML for TextItem. I need read this HTML and assign TextItem
My way is:
In Dataset OnFetch method:
reportContext.setPersistentGlobalVariable("myvalue",row.RESULT.toString());
In Text Item OnCreate method
this.text=reportContext.getPersistentGlobalVariable("myvalue");
But nothing. Solution for graph (recall with help icsc.getExternalContext().getScriptable().getPersistentGlobalVariable) i can not be used for TextItem
What is the correct way?
Find more posts tagged with
Comments
mwilliams
Why not just bind your html text element to your dataSet and then use the <value-of format=html></value-of> tag to call the row data?
Dakmen
Hi Michael,<br />
<br />
Thank you very very much. You saved my life
<br />
So easy... It works super.<br />
<br />
I have but next problem in dynamic Title for graph<br />
In external WebViewer(Firefox) it is working , but in eclipse I got message error <br />
<span class='bbc_underline'>TypeError: Cannot call method "toString" of null at line 13 of chart script:'' </span><br />
<br />
It is correct way ? Why is different behavior in eclipse ?<br />
<br />
<strong class='bbc'>OnFetch dataset (return label for graph in column name</strong><br />
reportContext.setPersistentGlobalVariable("graph_label",row.name.toString());<br />
<br />
And In function <strong class='bbc'>beforeGeneration</strong>( chart, icsc )<br />
{<br />
var title = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("graph_label").toString();<br />
chart.getTitle().getLabel().getCaption().setValue(title);<br />
}
mwilliams
How are you trying to run the report in Eclipse? With just preview or with the web viewer?
Dakmen
Sorry I was not exact
with the web viewer is it OK, the error occurs With just preview
mwilliams
It's probably a run&render task vs. separate run and render tasks issue then. The data is not available at the time you're trying to retrieve it in the preview, so it throws an error. You might be able to get around this in the preview if you attach a dummy text element to the dataSet you are trying to get the info from, and put the text element at the very beginning of your report, and hide it so it doesn't show the space. Let me know.
Dakmen
Thank you . It helped
I had an data item (as hide element) binding with a DataSet (to fire onFetch event of dataset) under graph item.
When I put this data item above graph item, everything works
In preview and in webviewer too
once again thank you very much
mwilliams
Not a problem. Let us know whenever you have questions!