Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

How to use functions of oracle in RB

edited September 2005 in RAP
?Hello,
I have created a function in oracle and want to create reports based n
this function. But the problem is that
1. I cannot include function to data dictionary.
2. I tried to create custom autosearch dialog box for the reports using
function .But i am not able to figure out how to do so. The problem is
that table name is to specified in createautosearchfield function.

Is it possible to include function in data dictionary.
I am using RB7.
Thanks
Lucy



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited October 2005
    Lucy ha scritto:
    Hi Lucy

    Are you using end user reporting ?
    In a end user solution (with Oracle) I use views (that eventually call
    pl/sql function) and included them in the rb data dictionary.
    For autosearch you can develop your own, it is quite simple
    Check the example in rbuilder\demos\5. autosearch

    Bye

    Nicola
  • edited October 2005
    hi ,
    I am using end user reporting solution. I have a pipelined function in
    oracle.Can you please send me the some example of how to make view from
    the function and include in data dictionary.It will be of great help.
    Thanks



    --- posted by geoForum on http://delphi.newswhat.com
  • edited October 2005
    Lucy,

    You have to use end user reporting *and*
    use rb data dictionary (see the help for the property UseDataDictionary
    of the TppDesigner). Have a look on the manual/help on this topic
    I was not totally precise, sorry for that.
    If anyway this is your situation you can put your metadata in RB
    dictionary tables.
    Let's say that you have a view like this (in scott Oracle example schema):

    create or replace view V_TEST as
    select CountEmp(d.deptno) as CtrEmpDept, d.dname, e.ename
    from emp e, dept d
    where e.deptno = d.deptno

    where CountEmp is a silly pl/sql function like this:

    create or replace function CountEmp(DeptNo in number) return integer is
    Result integer;
    begin
    select count(*)
    into Result
    from emp e
    where e.deptno = DeptNo;
    return(Result);
    end CountEmp;

    You can put in RB dictionary the V_TEST definition in this way (using
    default table/field names. You can customize it, see the manual.
    *not* using the autojoin feature for brevity)

    insert into rb_table(table_name,table_alias)
    values ('V_TEST', 'Test');
    insert into
    rb_field(table_name,field_name,datatype,selectable,searchable,sortable,field_alias,autosearch,mandatory)
    values ('V_TEST', 'CTREMPDEPT', 'dtInteger', 'T','T','T',
    'CTREMPDEPT','F','F');
    insert into
    rb_field(table_name,field_name,datatype,selectable,searchable,sortable,field_alias,autosearch,mandatory)
    values ('V_TEST', 'DNAME', 'dtString', 'T','T','T','DNAME','F','F');
    insert into
    rb_field(table_name,field_name,datatype,selectable,searchable,sortable,field_alias,autosearch,mandatory)
    values ('V_TEST', 'ENAME', 'dtString', 'T','T','T','ENAME','F','F');


    Now you can use this definition in your end user reporting.
    Start with the EndUser.dpr example (
    create the rb tables with the script included CreateEndUserTables.sql,
    in the delphi source:
    change databasename to link to you scott schema, set UseDatadictionary
    to true, autojoin to false)

    Hope this helps!
    Bye
    Nicola

    Lucy ha scritto:
This discussion has been closed.