Functions in Discoverer

I'm working with Discoverer 3.1 and I want to create a item that show me the sum of n-values. For example:
Location US$ FEB-2001 US$ TOTAL YEAR
A 10 15
B 12 21
In this example, JAN-2001 must be 5 for Location A, and must be 9 for location B in JAN-2001. In the page item I've the time period, then I just want to show this period in the Top axis.
How I can do that? I think that a must to create a function, but is there another way?
I'm working on Oracle8i Database.
Thanks
Mario Reyes C.

Hi,
You can more reference on the Analytic Functions available in Oracle in the Orale 8i SQL Reference for 8.1.7 Part No. A85397-01, under SQL Functions.
Thanks,
Selva

Similar Messages

  • How to use Pl/Sql function in Discoverer report

    Hi Everybody,
    Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
    (I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
    We are using Discoverer Desktop.
    a) Just emailed dba for permission to create pl/sql function.
    b) Recently got Discoverer Administrator installed on my pc.
    can you pls add to the list:
    c)....
    d)....
    etc.?
    tx for your help, sandra

    Hi Kranthi,
    Thx for your warm words....
    The links you provided are great! Thx soooo much!
    Thanks to you and the rest of forum members, am able to use what you've all taught me
    with other Discoverer reports.... so i was able to do more on my own....
    About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
    Then i joined the custom folder to an existing baseline folder.
    I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
    just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
    I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
    pl/sql functions for Discoverer.
    tx again, sandra

  • Passing parameter into select statement by using function in discoverer

    I have created two functions in database named Period_in and Period_out and a global variable  g_period_name
    I have called Period_out function in VIEW(Select statement where condition).
    I have registered Period_in function in discoverer admin then created calculation (called Period_in(:input parameter))in discoverer plus.
    My expectation is user will enter period name and that will hit Period_in function and returns 1 and stores entered period name in g_period_name at runtime. then VIEW will executed and fetches data.
    But i am getting no data found.
    Problem is 2 functions running at the same time in select statement. Please help me to overcome this. Thanks in advance
    FUNCTION period_in (p_period VARCHAR2)
          RETURN NUMBER
       AS
       BEGIN
          g_period_name := p_period;
          RETURN 1;
       END period_in;
       FUNCTION period_out
          RETURN VARCHAR2
       AS
       BEGIN
          RETURN g_period_name;
       END period_out;

    You can use this code: 
    WITH cte
    AS ( SELECT EmpID ,
    EmpName ,
    [dbo].[udf_testFunction](EmpID) AS testfunctionvalue
    FROM #Temp
    SELECT EmpID ,
    EmpName ,
    testfunctionvalue ,
    testfunctionvalue * EmpID ,
    testfunctionvalue + 2
    FROM cte
    But using scalar functions in select clause can hurt the performance. Please see this link: 
    SQL Server Scalar User Defined Function Performance
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • User Aggregated Function in Discoverer

    Hi.
    I'm trying to use an "User Aggregated Function" in Discoverer. This function concatenates a varchar field, and I want to use as a max(), min() or count() functions, but Discoverer always write this function in the group block of the query, and the databse generates an error.
    This is the user agrgegated function:
    CREATE OR REPLACE function DDS_UXXIINV.var_agg (input varchar2) return varchar2
    parallel_enable aggregate using agg_t;
    The package agg_t is defined as:
    create or replace type agg_t as object (
    str_agg varchar2(4000),
    static function ODCIAggregateInitialize(sctx in out agg_t)
    return number,
    member function ODCIAggregateIterate (self in out agg_t,
    value in varchar2 )
    return number,
    member function ODCIAggregateTerminate (self in agg_t ,
    return_value out varchar2,
    flags in number )
    return number,
    member function ODCIAggregateMerge(self in out agg_t,
    ctx2 in agg_t )
    return number
    create or replace type body agg_t is
    static function ODCIAggregateInitialize(sctx in out agg_t)
    return number is
    begin
    sctx := agg_t(null);
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(
    self in out agg_t, value in varchar2)
    return number is
    begin
    str_agg := str_agg || value;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self in agg_t,
    return_value out varchar2, flags in number) return number is
    begin
    return_value := str_agg;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self in out agg_t,
    ctx2 in agg_t) return number is
    begin
    str_agg := str_agg || ctx2.str_agg;
    return ODCIConst.Success;
    end;
    end;
    When I use this functions (as a calculated field) Discoverer generates this statment:
    select var_agg(field1), field2 form table group by var_agg(field1), field2;
    I want this statement:
    select var_agg(field1), field2 form table group by field2;
    Sometimes Oracle generates a error messages saying that there's a wrong combinations of joins (translated from spainsh)
    Regards
    Óscar Blanco

    Hi,
    Unfortunately, you cannot import user defined group functions into Discoverer, Discoverer does not understand them.
    Rod West

  • Distinct function in Discoverer

    Is there a way to use a distinct function in discoverer on a text field? I have the below calculation which concatenates 4 fields.
    Point Of Sales His.Submitting Partner Number||' - '||Point Of Sales His.Cleansed Submit Partner Number||' - '||Point Of Sales His.Submitting Partner Name||' - '||Point Of Sales His.Cleansed Submit Partner Name
    without a distinct function the report pulls in well over a million records and cant be used in excel. The 4 fields i am pulling in contain information that is repeated hundreds of times over within the table, but i only want to see 1 record for each unique return. Each record contains additional information which make the entire record unique, but I am not interested in that information at this time.
    Any ideas?
    Thanks
    Chris

    Hi Chris
    If you have millions of rows of data then although Tamir's suggestion will work you might find that it takes a while to run.
    If your data does not have to be up to the minute I would consider creating a new table and populating it nightly with the data that you need. You can then use a SELECT DISTINCT query in a procedure and even index the column in question. This will make report performance must, much faster.
    Best wishes
    Michael

  • Use of DECODE function in Discoverer 3.1

    Hi all,
    Is there any better way of using DECODE in Discoverer 3.1, i dont want to use that function in my Discoverer User edition or Admin ed.
    Many of my queries use the DECODE function.
    Your help is greatly appreciated.

    If you created an instance of your time class that you called myTime
    var myTime:Time = new Time(15,15,0);
    and later you wanted another instance with the same time you could write
    var myTime2:Time = myTime.clone()
    It is just there for convienience and doesn't have anything much to do with MVC

  • Importing PL/SQL function in Discoverer Admin

    Gents
    I'm trying to import a PL/SQL function. In fact this functions is in a package.
    When I try to import in Discoverer Admin, I'm not able to see this package and the function.
    It's possible import a function from a package in Discoverer?
    Must a grant some privilege in package or create a synonym?
    Regards
    Honorio

    Hey,
    I have a similar problem.
    I created a PL/SQL Function which i registered in my EUL. Bun when I'm using this function on an item in a custom folder, this custom folder disappeared from my Discoverer Plus list of folders? When I delete the item which uses this function the folder shows up in my Discoverer Plus list of folders.

  • Date Functions in Discoverer Query

    Hi,
    It has been a while since I logged into the forum. Sorry at present my contribution is only to get help. Hope to help others in future.
    Here is teh problem I am facing.
    We have frequent requirement to get the sales comparison by last year to this year
    in Week to Date, Month to Date, Year to Date timeline.
    To accomplish I use Custom Date functions in my Discoverer which results in query like below
    SELECT o100229.curr_division_code,
    SUM (DECODE (discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek),
    o100059.fiscal_year_week, o100341.tot_lines_ext_i_s_avg_cst,
    0
    The "discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek)" is the function I use to get the Last year week number nased on the parameter for this week number.
    But the problem with this approach is it fires the Function every time a record is read by the query which makes the query to run long time.
    Is there anyway I can use a subquery that fires the function only once and use the value of the function in the main query in Discoverer.
    I did tried to create a custom folder for the Date functions and use it in the query so that the query references the field on the cusom folder. But still I do not see any improvement in the performance.
    Thanks in advance
    Jay

    Hi Jay
    Yes, calculating like this on every row will have a drag on performance.
    Have you considered using one of the analytic functions LAG or LEAD? They are designed for this type of reporting.
    If you have considered them and rejected them can you explain why.
    Another possibility is to use a SUM analytic like this:
    SUM(Selling Price SUM)
    OVER(PARTITION BY Size,Product
    ORDER BY TO_DATE("Year",'YYYY')
    RANGE BETWEEN INTERVAL '1' YEAR PRECEDING
    AND INTERVAL '1' YEAR PRECEDING )
    The caveat here is that RANGE INTERVAL must be a YEAR and the ORDER BY must return a date!
    Does this help?
    Best wishes
    Michael

  • How to call Plsql function in discoverer

    Hello,
    Can anyone tell me how to call plsql fuunction in Oracle Business Intelligence Desktop Discoverer?
    what i was doing here is i am able to register my function in Administration but i dont know when i need to make call and where i need to pass parameters to make call that function.
    its lil urgent, can any of you guys send me the instructions step by step
    Thanks in advance!!
    sid

    Thanks for your reply Michael,some how i found that make call from calculation , but the problem here is i was not able to pass parameter thru function.please find the scenario below,
    case(1) i have function without parameters, it does some DML operations inside that and it is working fine.when i refresh i see tables getting populated.
    case(2)I have another function as shown below with parameters(input) but i was getting error (One of The function arguments has an incorrect datatype:POST_SAVE_DOCUMENT)
    my function is like this:
    create or replace function POST_SAVE_DOCUMENT
    (P_WORKBOOKOWNER in VARCHAR2,
    P_WORKBOOK in VARCHAR2,
    P_WORKSHEET in VARCHAR2,
    P_SEQUENCE in number,
    P_SQL_SEGMENT in VARCHAR2
    return number AS
    BEGIN
    delete from my_sql;
    insert into my_sql
    ( WORKBOOKOWNER,
    WORKBOOK,
    WORKSHEET,
    SEG_SEQUENCE,
    SQL_SEGMENT)
    VALUES ( P_WORKBOOKOWNER,
    P_WORKBOOK,
    P_WORKSHEET,
    P_SEQUENCE,
    P_SQL_SEGMENT
    return 1;
    end;
    i dont see anything wrong here with in this function, but some how i have a problem with parameter.
    Can you give some idea or solution to get rid of this problem.
    Finally ..i did not see anything under item radio button (The recommended way now is to click the Items radio button, find an item that you want to pass to a parameter, then on the right-hand side highlight the placeholder for the parameter, then finally you click the Paste button. You repeat this for all the parameters and then click OK to finish the calculation.
    Thanks in adavance!!
    Thanks
    S!D
    Edited by: user12861418 on Apr 28, 2010 2:01 PM

  • SSO  Using Sys_Context function in Discoverer to validate

    We are using a calculation which uses the function SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER') in 10G, we are now upgrading to 11G and this function does not work. Can someone direct me to what action I need to change 'Client_Identifier" to or how to make this work in 11G

    Hello
    Are you talking about upgrading Discoverer from 10g to 11g or the database from 10g to 11g?
    Also, when you say "it does not work" can you be more specific? Do you get any error messages and have you been able to test this using something like TOAD?
    Perhaps it is as simple as a missing grant to the Discoverer user? Here's the script I use, perhaps you can take a look and see if your users have the same privileges.
    accept username prompt'Enter Username: '
    accept pword prompt'Enter Password: '
    create user &username identified by &password;
    grant connect, resource to &&username;
    grant analyze any to &&username;
    grant create procedure, create sequence to &&username;
    grant create session, create table, create view to &&username;
    grant execute any procedure to &&username;
    grant global query rewrite to &&username;
    grant select any table, unlimited tablespace to &&username;
    grant execute on sys.dbms_job to &&username;
    grant select on sys.v_$parameter to &&username;
    Does this help?
    Michael

  • Functionality in Discoverer 11g to limit the users or reports that consume

    Experts,
    I am using Discoverer 10g(9.0.4) ... we are upgrading to Discoverer 11g Fusion Middleware . i want to know if there is any functionality in 11g where we can limit the resources for users or reports that they usually consume in 10g .......
    let me know if my question is not clear?

    Hello,
    If I understand your question correctly, no this is not possible. There is no tool or method to have Discoverer 11g review the 9.0.4 statistics/usage and then limit the resources based upon the 9.0.4 usage.
    You can limit the number of rows returned or set requirement to schedule worksheets that are estimated to take over specific time and other such settings. These same settings are available in 9.0.4 as well.
    Regards,
    Sharon

  • Reasons for Introducing database functions for Discoverer Reporting Needs

    Hi All,
    I would like to know the criteria other organizations have used in creating custom database functions specifically for Discoverer reporting needs. It seems good and appropriate to identify these reasons in order that they have a sufficiently good reason (e.g. in presenting this to a change management board).
    Here is a quick swipe:
    -query explain plan improvements
    -take away the complexity of having the end user deal with complex calculations
    -consistency of a value (e.g. a complex amortization calculation)
    -an attribute is used from a dependent table with a minimum cardinality of zero
    Can anyone list other good reasons in terms of Discoverer reporting?
    Thanks,
    Patrick
    Edited by: Patrick Bacon on Jul 15, 2009 10:30 AM

    Hi Patrick
    In addition to the reasons you have given the reasons for having functions anyway apply just as equally to Discoverer as they do to other applications.
    Typically the main reasons why I would use a function are:
    a) due to the complexity of the code, or
    b) to evaluate something which an end user either could not do or does not have access to.
    For example if a user needs to have aggregations from multiple tables side by side in a report, typically from tables which have no joins between them, I write functions to go get the individual results.
    One specific function that I use a lot is one that calculates the number of working days between any given two days. Some of my HR customers use such a function to calculate the number of sick days for an employee when obviously only working days should count. Doing this in a normal Discoverer calculation would be very hard. Retail customers might use this for calculating the number of days it took to ship and item.
    There are other reasons why I use functions but these are the typical ones.
    Best wishes
    Michael

  • Too many functions on discoverer

    Hi all,
    I'm creating a New report under discoverer desktop, and I'm having a problem.
    this report has 7 functions. some of them looks for a Max or Min on a audit table and the others performs different calculations with dates (e.g (01-JAn-2009 15:02:09) - (15-Feb-2009 10:56:30)). All of the functions works with internal queries.
    Currently the report takes 2 minutes to display the results.
    The problem is that now I have to add another function that performs a Count(*) from the same audit table (with a where condition), and when I add it, the report never retrieves the results. Is taking at least 20 minutes to run (and does't finish)
    what is the best practice under discov. Is it possible that too many Functions affect the performance of the report?
    As other issue:
    Is there anyway to use as a parameter of a function, the result of an other function used under the same report?
    lets say, I have function1 on the report and I need tu use the result diplay by that function as a parameter for function2
    Thanx a lot...
    Belen

    I don't fully understand your setup but if you are querying the same table over and over is it possible to set up a custom folder that will query the table once and return all of the required values?
    You could add calculated columns and filters as required.
    In this example the min and max dates are looking at rows 2-4 and the count is looking at rows 4-5.
    var START_DATE DATE
    var END_DATE DATE
    var MIN_ID VARCHAR2
    var MAX_ID VARCHAR2
    BEGIN
       :START_DATE := trunc(SYSDATE) + 2/24;
       :END_DATE := trunc(SYSDATE) + 4/24;
       :MIN_ID := 4;
       :MAX_ID := 5;
    END;
    PL/SQL procedure successfully completed
    WITH audit_table AS (
       SELECT 1 t_id, 100 val, trunc(SYSDATE) + 1/24 dt FROM dual UNION ALL
       SELECT 2 t_id, 200 val, trunc(SYSDATE) + 2/24 dt FROM dual UNION ALL
       SELECT 3 t_id, 300 val, trunc(SYSDATE) + 3/24 dt FROM dual UNION ALL
       SELECT 4 t_id, 400 val, trunc(SYSDATE) + 4/24 dt FROM dual UNION ALL
       SELECT 5 t_id, 500 val, trunc(SYSDATE) + 5/24 dt FROM dual)
    SELECT MIN(CASE
                   WHEN dt BETWEEN :START_DATE AND :END_DATE THEN
                    dt
                   ELSE
                    NULL
                END) min_t_id,
           MAX(CASE
                   WHEN dt BETWEEN :START_DATE AND :END_DATE THEN
                    dt
                   ELSE
                    NULL
                END) max_t_id,
           COUNT(CASE
                     WHEN t_id BETWEEN :MIN_ID AND :MAX_ID THEN
                      1
                     ELSE
                      NULL
                  END) sample_cnt
    FROM audit_table
    WHERE dt BETWEEN :START_DATE AND :END_DATE
    OR t_id BETWEEN :MIN_ID AND :MAX_ID;
    MIN_T_ID                 MAX_T_ID                 SAMPLE_CNT
    4/29/2009 2:00:00 AM     4/29/2009 4:00:00 AM              2

  • Is it possible to achieve Group By....Having functionality in Discoverer?

    Hello All,
    I need to print amount due for each customer when it is negative (less than zero). i.e. sum of all transactions against the customer should be less than zero. This is simple through sql if we write "select sum(amount) group by customer having sum(amount) < 0".
    But I need to do this in discoverer. Now the issue is I need to pass two parameters at runtime. First one will be Date (<= as_of_date) and another one will be having multiple values (in clause).
    If I base my report on underlying report view which uses 'group by... having' sql as described above, I will have to use parameter sheet and use syscontext to pass parameters.
    Instead, it will be easier if i pull in all the data in discoverer report and then use parameters to filter it out. But then is there any way to group on customer and having clause to print only those customers where sum(amount) < 0?
    Anish

    Hi Russ,
    I am new to discoverer so pardon me if I am not able to get you quickly.
    I am sorry, but I did not get you when you say calc1 = SUM( CASE WHEN amount <0 then amount ELSE 0 END).
    May be I was not able to describe you problem. Below is the SQL statement that will give me desired results. I want to achieve same results in Discoverer by getting rid of outer select query with grouping. I will be passing org_id and GL date as parameters.
    select customer_number, name, sum(amount_due) Amount_Due, org_id, Business_Segment
    from
    SELECT hca.account_number customer_number, hp.party_name NAME,
    aps.trx_number, aps.gl_date,
    aps.amount_due_remaining amount_due, aps.class, aps.org_id org_id
    ,hca.attribute3
    FROM apps.ar_payment_schedules_all aps,
    apps.hz_cust_accounts hca,
    apps.hz_parties hp
    WHERE aps.org_id IN (570, 573)
    AND aps.gl_date <= '30-NOV-2008'
    AND aps.class in ('CM','INV','DM')
    AND aps.customer_id = hca.cust_account_id
    AND hca.party_id = hp.party_id
    group by customer_number, name,org_id, Business_Segment
    having sum(amount_due) < 0
    order by 1
    Hope I am able to explain you now.
    Thanks,
    Anish

  • Performance issue with Export functionality in Discovere

    Hi ,
    I am running a discoverer report which is taking only 3 minutes to complete. But when we try to export it to Excel , it takes 2 hours.
    There are only 1500 records to be exported.
    Has anyone faced this type of issue ?
    Thanks for your help in advance.

    Pl post your version of Discoverer - are you exporting out of an EBS instance ? Does this work on other PCs or for other workbooks ? Pl see if these MOS Docs are helpful
    245752.1 - Explaining Oracle BI Discoverer Session Memory Management And Server Cache Settings
    237607.1 - ALERT: Required and Recommended Patch Levels For All Discoverer Versions
    HTH
    Srini

Maybe you are looking for

  • Help to access a JTextArea created in another method ?

    Hello, first I am a new to java although i am a very experienced PHP programmer ... i am having trouble figuring out why i cannot access the JTextArea created inside BuildContainer() in my program below from another method NewFile(). I am sure its ju

  • Step by step sdk java bo xi r2

    Post Author: gzofera CA Forum: JAVA good afternoon to all   I would like to customize the web intelligence business you work, most do not know how to set up an environment to work with the sdk, I would like to know where to find tutoring to teach the

  • Why am I getting these error messages?

    Photoshop Camera Raw 8.4(CS6) Installation failed. Error Code: U44M1P7 Extension Manager 6.0.8 Update Installation failed. Error Code: U44M1P7 Adobe Photoshop 13.0.6 Installation failed. Error Code: U44M1P7

  • Transfering Licenses - Student to Commercial to New Owner?

    I understand that licnses are not transferable if they are student/teacher versions. Here is my situation: I have originally bought a copy of a Adobe design suite at the student/teacher price. Since then I have moved on from my student/teacher elegib

  • One invoice - two accounting document

    Hi to all, can someone help me with this issue ? I have to make this case: creation of SD invoice - creation of accounting document - creation of another accounting document which derives from previous one. First two steps are standard process, but f