Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Create SQL-Querys dynamically
Migrateduser
Hi All,<br />
i have to solve a problem in eclipse BIRT with dynamically created querys/datasets.<br />
I'm comming from Oracle Report, and want to use/migrate/redesign my reports.<br />
The problem is, in Oracle-Reports i can use PL/SQL and SQL querys built in Reports.<br />
Example:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
FUNCTION BeforeReport
RETURN BOOLEAN
IS
l_value VARCHAR2(256);
BEGIN
SELECT mycol
INTO l_value
FROM mytable
WHERE ....;
IF(l_value == 'whatever')THEN
-- TODO
--
--
RETURN TRUE;
END IF;
RETURN FALSE;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN FALSE;
END BeforeReport;
</pre>
<br />
The question is, how can i execute new querys or create NEW DataSets (please without a dummy Dataset and beforeopen event)<br />
consume the resultset and close the cursor etc.<br />
What i found, is the way over a existing Dataset, manipulate textQuery etc.<br />
I want to create a javascript library to put in usefull funtions and procedures.<br />
Example of pseudo code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function executeQuery(p_datasource, p_query, p_params)
{
// check the paramters
if(p_datasource == null || p_query == null)
return null;
var connection = p_datasource;
var statement = p_datasource.prepareStatement(p_query);
statement.setParameter(1, p_params[1]);
var res = statement.execute_query();
return res;
}
</pre>
somewhere in report<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var resultset = executeQuery("myStaticDataSource", "SELECT mycol FROM mytable WHERE user_id > ?", "5");
while(resultset.hasnext){
var myvalue = resultset.next().getValue("mycol");
...
// do somewaht
...
}
resultset.close();
</pre>
<br />
PS:
Find more posts tagged with
Comments
There are no comments yet