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)
Displaying SQL Directly to Report Screen
onthegomiller
<p>Hi,</p>
<p> </p>
<p>I'm looking to see if there is a relatively simple way to display the SQL statement w/in a BIRT report directly to the report at run time?</p>
<p> </p>
<p>Thanks.</p>
Find more posts tagged with
Comments
JFreeman
<p>There are most likely a few ways this can be done.</p>
<p> </p>
<p>One way is to put the query text into a persistent global variable in the beforeOpen of the data set and then read the same persistent global variable in onCreate of a text element to display the query text within the report design.</p>
<p> </p>
<p>For example:</p>
<p> </p>
<p>beforeOpen of Data Set:</p>
<pre class="_prettyXprint _lang-js">
reportContext.setPersistentGlobalVariable("query", this.queryText);
</pre>
<p>onCreate of Text Element:</p>
<pre class="_prettyXprint _lang-js">
this.text = reportContext.getPersistentGlobalVariable("query");
</pre>
<p>Take a look at the attached sample report for reference.</p>
onthegomiller
<p>Thank you, JFreeman. I will give this a shot.</p>
<p> </p>
<p>Appreciate your time.</p>
JFreeman
<p>You're welcome.</p>
<p> </p>
<p>Let us know if you have additional questions.</p>
wwilliams
<div>For Maximo I just create a variable in the beforeFactory (please note MBlock) :-)</div>
<div>such as sqltxt = new String();</div>
<div> </div>
<div>then in the open of the dataset before the setQuery</div>
<div>sqltxt = sqlText;</div>
<div>maximoDataSet.setQuery(sqlText);</div>
<div> </div>
<div>Then add a data element to the header so it shows even if Maximo pukes on the SQL</div>
<div> </div>
<div>I am guessing JFreeman's solution won't work with Maximo's implementation.</div>