Hi All,
i have to solve a problem in eclipse BIRT with dynamically created querys/datasets.
I'm comming from Oracle Report, and want to use/migrate/redesign my reports.
The problem is, in Oracle-Reports i can use PL/SQL and SQL querys built in Reports.
Example:
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;
The question is, how can i execute new querys or create NEW DataSets (please without a dummy Dataset and beforeopen event)
consume the resultset and close the cursor etc.
What i found, is the way over a existing Dataset, manipulate textQuery etc.
I want to create a javascript library to put in usefull funtions and procedures.
Example of pseudo code:
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;
}
somewhere in report
var resultset = executeQuery("myDataSource", "SELECT mycol FROM mytable WHERE user_id > ?", "5");
while(resultset.hasnext){
var myvalue = resultset.next().getValue("mycol");
...
// do somewaht
...
}
resultset.close();
PS:
sorry for my bad english.
Any ideas?