Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » create SQL-Querys dynamically
create SQL-Querys dynamically [message #1022242] Thu, 21 March 2013 14:30
Ioan Molnar is currently offline Ioan MolnarFriend
Messages: 1
Registered: March 2013
Junior Member
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?
Previous Topic:How to check parameters
Next Topic:Table Cell block height
Goto Forum:
  


Current Time: Wed Apr 24 22:23:53 GMT 2024

Powered by FUDForum. Page generated in 0.02560 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top