SVG multiline chart based on PL/SQL function

Dear all -
Having trawled this forum and with a fair bit of experimentation I've concluded that:
1. Generating an SVG line series using a PL/SQL function returning a SQL statement is perfectly possible;
BUT
2. It only works for a single series. Adding further series blanks out the SVG chart area and nothing at all is displayed.
Can anyone tell me if this is right or am I missing a trick? The usual problems such as ordering, nulls etc. don't apply in this case.
Thanks for your time.
John.

On some, but not all SVG line charts, I had trouble when some values are ZERO.
Putting a CASE WHEN var = 0 then 0.05 ELSE var END in the select statement
fixed those situations.
I had missing lines when the number of data points in a series exceeded the default number of 15, and I did not set in the series configuration to a number equal to or higher that the number of data points in that series.
And I had one instance, where a couple missing lines reappeared when I exited
the browser and app completely and restarted the app.
All these comments apply to ver 1.6x and 2.0x

Similar Messages

  • Problems with SVG line charts based on PL/SQL returning SQL

    Dear all - I wonder if anyone can tell me whether this problem is likely to be fixed at some point?
    It relates to the fact that you can't get more than one series on a chart where the SQL is returned from PL/SQL.
    It is a huge issue for us when trying to create complex, dynamic charts, which are simple enough in PL/SQL, but end up quite nightmarish in pure SQL.
    Although we have implemented Maani SWF (Flash) charts as a workaround, users don't like them as there's no 'save as...' or copy+paste and they seem to print very badly indeed.
    Here's part of a post from last May with more detail:
    "If I take a really simple table like this:
    CREATE TABLE "CHART_TEST"
    ( "X" DATE NOT NULL ENABLE,
    "Y" NUMBER(5,0) NOT NULL ENABLE,
    CONSTRAINT "CHART_TEST_PK" PRIMARY KEY ("X") ENABLE
    and populate it with:
    X Y
    2006-01-01T00:00:00 1
    2006-02-01T00:00:00 2
    2006-03-01T00:00:00 3
    2006-04-01T00:00:00 4
    2006-05-01T00:00:00 5
    2006-06-01T00:00:00 6
    2006-07-01T00:00:00 7
    2006-08-01T00:00:00 8
    2006-09-01T00:00:00 9
    2006-10-01T00:00:00 10
    I can create a chart with a single series using syntax something like:
    begin
    return 'select null link, x label, y value
    from chart_test';
    end;
    and this works fine. However, if I add a second series:
    begin
    return 'select null link, x label, (y + 1) value
    from chart_test';
    end;
    then the whole of the chart region blanks out.
    There's an example at:
    http://htmldb.oracle.com/pls/otn/f?p=15491:1"
    Many thanks,
    John.

    On some, but not all SVG line charts, I had trouble when some values are ZERO.
    Putting a CASE WHEN var = 0 then 0.05 ELSE var END in the select statement
    fixed those situations.
    I had missing lines when the number of data points in a series exceeded the default number of 15, and I did not set in the series configuration to a number equal to or higher that the number of data points in that series.
    And I had one instance, where a couple missing lines reappeared when I exited
    the browser and app completely and restarted the app.
    All these comments apply to ver 1.6x and 2.0x

  • Materialized View with column based on PL/SQL function returning object

    I have the following problem - it is known that materialized view wants PL/SQL functions used in it to be DETERMINISTIC. And it appears that a function which returns SDO_GEOMETRY cannot be DETERMINISTIC - I can add DETERMINISTIC modifier to my function which returns sdo_geometry based on USNG grid ID and save the package, and it compiles and runs fine with regular queries, but when it comes to materialized view (mview), the following error is thrown:
    ORA-12018: following error encountered during code generation for "SCHEMA"."MVIEW_NAME"
    ORA-00932: inconsistent datatypes: expected NUMBER got MDSYS.SDO_GEOMETRY
    Looks like DETERMINISTIC modifier is not fully supported for object types. I have tried to use SDO_CS.FROM_USNG Oracle's function, and it appeared that this function is also non-deterministic - I cannot refresh mview with P or F on-demand refresh method (see http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14223/refresh.htm#i1008349 for a list of on-demand refresh methods). Without that function I can refresh mview with P or F flags.

    Hi,
    Yes, the Chart Series can be based on "Function Returing SQL Query" and the "SQL" would be something like:
    DECLARE
    vSQL VARCHAR2(1000);
    BEGIN
    vSQL := 'SELECT NULL LINK, ENAME LABEL, SAL VALUE FROM EMP ORDER BY ENAME';
    RETURN vSQL;
    END;You should tick the "Save query without validation" underneath that. Without this, there is a validation error - the ; at the end is required to get the chart to function correctly but the validator sees this as an error.
    You would need to create this separately from the report. No matter how you did it, the chart would still run a SQL statement to generate the output. If you wanted to use the "same data", then you could create a collection using the PL/SQL and base both the report and the chart on the collection instead.
    Andy

  • Dynamically adding attribute based on PL/SQL function

    I've been tasked with dynamically applying security to an XMLType input sample as a post XML generation process (on an 11g R2 DB) based on several parameters. The best way to describe it is with an example block of code, I need to write ApplySecurity....
    declare
      vXML XMLType;
      BONUS_SEC constant integer := 24; -- Security identifier for Bonus
      function ApplySecurity(pXML        XMLType,
                             pSecurityID integer,    -- A Security identifier
                             pDataIDPath varchar2,   -- Absolute XPath to the data id which is passed to value
                             pAttribPath varchar2    -- Relative XPath to pDataIDPath where we want the security result attribute stored
                             ) return XMLType is
      begin
          for all DataIDs found in pDataIDPath
            Call an PL/SQL function GetSecurityDesc(pSecurityID, pDataID)
              Store the result of this back in the XML in the pAttribPath as SECURITY attribute
      end;
    begin
      vXML := ApplySecurity(XMLType('<ROWSET>
                                       <ROW>                                
                                         <BONUS_ID>8</BONUS_ID>
                                         <DESCRIPTION>Test Bonus</DESCRIPTION>                                                                           
                                       </ROW>
                                       <ROW>                                
                                         <BONUS_ID>9</BONUS_ID>
                                         <DESCRIPTION>Another Bonus</DESCRIPTION>                                                                           
                                       </ROW>                         
                                       <ROW>                                
                                         <BONUS_ID>10</BONUS_ID>
                                         <DESCRIPTION>April Bonus</DESCRIPTION>                                                                           
                                       </ROW>                         
                                     </ROWSET>'),
                             BONUS_SEC,       
                             '/ROWSET/ROW/BONUS_ID',
    end;
    /* Example of the Desired Output =
    <ROWSET>
      <ROW>                                
        <BONUS_ID SECURITY="HIDDEN">8</BONUS_ID>
        <DESCRIPTION>Test Bonus</DESCRIPTION>                                                                           
      </ROW>
      <ROW>                                
        <BONUS_ID SECURITY="READONLY">9</BONUS_ID>
        <DESCRIPTION>Another Bonus</DESCRIPTION>                                                                           
      </ROW>                         
      <ROW>                                
        <BONUS_ID SECURITY="NONE">10</BONUS_ID>
        <DESCRIPTION>April Bonus</DESCRIPTION>                                                                           
      </ROW>                         
    </ROWSET>
    */I have tried several approaches like iterating using a dynamically created XMLTable and calling InsertChildXML for each iteration, but that seems messy and inefficient as the call to InsertChildXML will have to locate the correct node each time. Ideally I think the best solution would be to do it with XQuery, but online examples are few and far between and I don't know how I'd call a PL/SQL function as part of an XQuery iteration as well as passing in the path information.
    Anyone have any ideas? Thanks!

    A funnier option, adapted from http://odieweblog.wordpress.com/2012/06/19/how-to-update-xml-nodes-with-values-from-same-doc/ :
    declare
      BONUS_SEC  constant integer := 24;
      vXML XMLType := XMLType(
    '<ROWSET>
      <ROW>                                
        <BONUS_ID>8</BONUS_ID>
        <DESCRIPTION>Test Bonus</DESCRIPTION>                                                                           
      </ROW>
      <ROW>                                
        <BONUS_ID>9</BONUS_ID>
        <DESCRIPTION>Another Bonus</DESCRIPTION>                                                                           
      </ROW>                         
      <ROW>                                
        <BONUS_ID>10</BONUS_ID>
        <DESCRIPTION>April Bonus</DESCRIPTION>                                                                           
      </ROW>                         
    </ROWSET>');
      pSecurityID integer      := BONUS_SEC;
      pDataIDPath varchar2(80) := '/ROWSET/ROW/BONUS_ID';
      pAttribPath varchar2(80) := '.';
      queryString varchar2(4000);
    begin
      queryString :=
    q'~select xmlpatch(
             :b1
           , xmlelement("xd:xdiff"
             , xmlattributes(
                 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
               , 'http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd' as "xsi:schemaLocation"
               , 'http://xmlns.oracle.com/xdb/xdiff.xsd' as "xmlns:xd"
             , xmlpi("oracle-xmldiff", 'operations-in-docorder="true" output-model="current"')
             , xmlagg(
                 xmlelement("xd:append-node"
                 , xmlattributes(
                     'attribute' as "xd:node-type"
                   , '(#DATA-ID-PATH#)[' || x.NodeOrder || ']' as "xd:parent-xpath"
                   , 'SECURITY' as "xd:attr-local"
                 , xmlelement("xd:content", GetSecurityDesc(:b2, x.DataID))
    from xmltable('#DATA-ID-PATH#'
           passing :b3
           columns DataID    integer path '#ATTRIB-PATH#'
                 , NodeOrder for ordinality ) x~';
      queryString := replace(queryString, '#DATA-ID-PATH#', pDataIDPath);
      queryString := replace(queryString, '#ATTRIB-PATH#', pAttribPath);
      execute immediate queryString into vXML using vXML, BONUS_SEC, vXML ;
      dbms_output.put_line(vXML.getclobval);
    end;
    /probably slower though.

  • Interactive Report based on pl/sql function body

    Can an interactive report be based on a pl/sql function body returning the query sql? Or does it have to be based directly on the SQL?
    Thanks

    Hello "unknown user",
    As far is I know an Interactive Report can only be based on 'regular' SQL. If you have a Report based on a 'PL/SQL function body returning SQL' the option to migrate the report to an interactive report is not there.
    Regards,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Javascript based on PL/SQL function.

    Hey all,
    I'm developing an application with Apex and have run into a problem.
    I have a form page with the standard create, delete and cancel buttons. I need to be able to click the Create button, which will run a PL/SQL query, and based on the return of the function, either just continue the Insert to the table, or generate a popup warning, and then complete the table insert.
    I was thinking of having a Process that ran the javascript, and was conditional on the PL/SQL query, however i haven't had much luck.
    Any help appreciated.
    Thanks,
    Brett Crowley.

    Hello Brett,
    >> I was thinking of having a Process that ran the javascript, and was conditional on the PL/SQL query, however i haven't had much luck.
    APEX Processes are server-side resources, while JavaScript is a client-side resource. As such, you can’t invoke JavaScript code from within a PL/SQL code. However, the reverse direction – invoking PL/SQL code from a JavaScript code – is possible by using AJAX. In general, using AJAX allows you to call to an APEX on-demand PL/SQL (application) process, which in turn can return a result to the calling JavaScript code. In this point, based on the returned result, you can decide whether to issue an alert box or (programmatically) submit the page for further processing.
    This forum includes many example of using AJAX, and I believe that the following article can also be a helpful starting point.
    http://www.packtpub.com/article/ajax-implementation-apex
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Webservice based on PL/SQL function - ORA-04068

    Hi,
    we have a problem here with PL/SQL based webservices. If the PL/SQL package gets invalid then the very first request to the webservice results in:
    java.sql.SQLException:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "TUG_NEW.WBSERVICES" has been invalidated
    ORA-04065: not executed, altered or dropped package "TUG_NEW.WBSERVICES"
    ORA-06508: PL/SQL: could not find program unit being called ORA-06512: at line 1
    Any workarounds? Shouldn't the package become recompiled automatically when it was invalid?
    Thanks, Christian

    the caller gets an error on the first request. from the second request on it works ... indicates the package is not yet recompiled when the first request is sent. When the second request is sent, the package has been recompiled.

  • Application Report Missing PL/SQL Functional Area

    All,
    I just wanted to bring to the ApEx developers something I just noticed... I use the Shared Components > Database Object Dependencies report to make sure all is well before moving applications into production.
    The Parsing Errors feature of that report is WONDERFUL! But it seems to be overlooking buttons that use a conditional display based on PL/SQL Function Body Returning a Boolean.
    Dan

    Hi Dan,
    I think the place is perfect, but I read once somewhere that "Bug" or "Bug Report" should be in the subject so that's easier to find for the Oracle guys.
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • SVG line chart raises ORA-20001 witha valid SQL query

    Hi,
    I am on version 1.6 & 10g database. I developed an SVG line chart which was working fine, but I wanted to fill in some sparse data by using data densification. So I enhanced my query with a partitioned outer join as follows:
    select null l, month_start, issue_count
    from
    (with dates as
    (select add_months
    ( to_date( '01-jul-2004' ),
    column_value-1) dt
    from table( vtable(12) )),
    iss as
    (select trunc(start_date, 'MON') mon , count(*) cnt
    from issues
    group by trunc(start_date, 'MON'))
    select dates.dt month_start, NVL(iss.cnt, 0) issue_count
    from dates left outer join iss on (dt=mon)
    Now the chart throws an ORA-20001 get_data error. The query is valid as it runs in SQL*plus no problems. What is it choking on?
    Thanks,
    Steve

    Steve,
    I didn't mean for you to put in on the Studio, just install the app in your workspace on htmldb.oracle.com, use SQL Workshop there to compile your procedures, tell us the app ID, and that's it.
    The error message presentation needs some improvement, give us time. We're spending most of our energy on improving the capability of the product.
    Scott

  • Reports based on PL/SQL Procedure/Function

    Hi all,
    After some serious Google and forum searches, it appears as if this is something that just isn't possible (or easy to do).
    I've been charged with creating an APEX application that displays reports. There are a series of Procedures that will be written to return a result set, updated to take into account some filters that a user would provide. The key here is that the report won't be displayed until AFTER a user inputs some filters on a form and hits a Submit button. The project requires this functionality - allowing the report to be displayed and THEN filtered using the APEX IR Control is not desired (not my decision).
    There doesn't seem to be an easy way to define a report in this manner. It appears that the query for a report query needs to be known ahead of time.
    So, with that setup - is there a way to define an APEX report based on the return result of a PL/SQL function? OR is there a way to define a report using a SQL Query that is built based on user inputs?
    Any help would be appreciated.
    - Pedro

    Hi,
    Check if this post help you.
    Dynamic html table
    And normal reports can be also created from select that function is returning.
    http://www.oracle.com/technology/products/database/application_express/howtos/dynamic_report.html
    Br, Jari
    Edit:
    Maybe useful
    http://www.apex-blog.com/oracle-apex/dynamic-report-regions-tutorial-32.html
    http://www.oracleapplicationexpress.com/2009/02/interactive-report-based-on-plsql.html
    Edited by: jarola on Sep 9, 2009 5:14 PM

  • "no data found" in SVG Line Chart

    Hello,
    I have a problem with a SVG Line Chart!
    I have multiple series in the Line Chart, which data is based on multiple select lists.
    When I leave one select list blank, so that one line has no data, the "no data found" statement appears in the Chart.
    But when I delete the "no data found" statement in the Series Attributes it would not be deleted. Nevertheless when I open the Series Attributes again the message is still there....
    Does anybody have an idea how I van delete the "No Data found Message"???
    Thanks,
    Tim

    Chris and Cristoph -
    I have found that many times errors like this are caused by SQL statements that don't really address the business need or the requirements for the chart. Let me use a simple example:
    SELECT d.dept_name  dept_name,
           sum(s.sales_total)  sales_total
    FROM orders o, depts d
    WHERE o.dept_id = d.dept_id
      AND o.time_frame = 'Q1'
    GROUP BY dept_nameSeems simple enough. But what if this statement is run early during the Q1 timeframe and one dept hasn't made any sales yet? Well, they won't show up in the output of this statement. From a business perspective, you will want that dept to show on the report with a zero total sales. You don't want them excluded from the report. So how do we fix this?
    There are several options.
    One dirty way of solving this is putting in a dummy record for each dept into the orders table with a 0 sales_total value for each time unit. YUK! That has wrong written all over it!
    We could use a different type of join. And then use NVL or a Case or IF statement to turn Null Values into 0.
    SELECT d.dept_name dept_name,
           sum(nvl(s.sales_total,0))  sales_total
    FROM  orders o RIGHT JOIN dept d ON d.dept_id = o.dept_id
    WHERE o.time_frame = 'Q1'
    GROUP BY dept_nameWe could also square our data sets and summarize with an inner select
    SELECT dept_name dept_name,
           sum(sales_total) sales_total
    FROM (
      SELECT d.dept_name ,
             sum(s.sales_total)  sales_total
      FROM orders o, dept d
      WHERE o.dept_id = d.dept_id
        AND o.time_frame = 'Q1'
      GROUP BY dept_name
      UNION ALL
      SELECT DISTINCT dept_name ,
             0 sales_total
      FROM dept
    GROUP BY dept_nameThe final result is that every dept has a value. That is the key. This is how the chart expects the data and this is probably how your business expects the data.
    Austin

  • How to create dynamic ed flash charts based on user selected fields in Orac

    Hi all,
    Can any of the experts please tellme "how to create dynamic ed flash charts based on user selected fields in Oracle apex".
    Thanks
    Manish

    Hello,
    Lots of different ways to do this, I blogged about one way (using a Pipelined function) here -
    http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
    Other options include using a PL/SQL function returning the string to use as the dynamic query etc.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Chart based on Select list with submit Lov problem

    Hi,
    I have one page with interactive report showing username with links, date and
    database actions.
    Another page contains one region having flash chart based on select list with submit Lov.
    The lov is created by dynamic query.
    Every time when i click the 1st page report link, the 2nd page lov is populating the value automatically. But the problem is chart displays NO DATA FOUND message though the LOV has many values.
    I don't want to display any null values so set to NO for LOV
    I tried to write Before header computation (PL/SQL Function Body) to set the lov value, but the query is displayed as such.
    I don't want to assign any static default value also as the values are dynamic for every link.
    The following is my Before header computation of Select list with submit (Item name is p11_schema). (PLSQL Function Body)
    begin
    if :p11_schema is null then
    return 'select distinct owner schema1, owner schema2 from auditing
    where access_date=' || :p11_access_date
    || ' and username=' || :p11_username
    || ' order by owner';
    end if;
    end;
    This is my chart query.
    select null link, obj_name label, sum(sel_count) "Select", sum(ins_count) "Insert", sum(upd_count) "Update", sum(del_count) "Delete" from auditing
    where username=:p11_username
    and access_date=:p11_access_date
    and owner=NVL(:p11_schema, OWNER)
    group by owner, obj_name
    Example: If there more than one records in the lov, the graph should display the 1st record. When i select another record, the chart accordingly display the selected values. But inially it should not display "NO DATA FOUND" message.
    I tried using all the combinations of computation type for the lov, SQL query ( I could not use if conditon then), PLSQL expression, PLSQL function body. But it does not work out.
    Can anyone please help me out.
    Thanks.

    Hi Scott,
    Thanks for your reply.
    I found out the solution for this problem as below.
    But i did it in different way to tackle the dynamic query wich returns more than one record using rownum always the 1st record when it is empty instead of assigning constant (static) value like '1'. And i am returning LOV itself for both null or not null condition as below.
    Declare
    q varchar2(4000);
    begin
    if :p11_schema is null then
    q:='select distinct owner schema from auditing';
    q:=q || ' where username=:p11_username ';
    q:=q || ' and access_date=:p11_access_date ';
    q:=q || ' and rownum<2 order by owner';
    Execute immediate q into :p11_schema USING :p11_username, :p11_access_date;
    end if;
    return :P11_SCHEMA;
    end;
    Thanks.

  • Dynamic bar chart based on LOV selected

    Apex 2.1 with XE : running on windows xp.
    I am trying to create charts based on selected criteria such as level 1, level 2 and level 3. If the user selects level 1 chart is expected to group level 2 and level 3 parameters else if the user selects level 2 criteria on top of level 1 then it should filter to the next category and so on. To make it simple I created three different queries which would generate the required graphs.
    To achieve this I decided to use PL/SQL function that would return three different chart queries based on the LOV selection. Although the function works well for each of the queries they dont work with a if else condition based on LOV selection. So what is the problem with creating such as dynamic query. Can I use the "%" values of LOV in my if else condition if not why ?
    Any alternatives ?

    Well. The queries for the charts run independently well. I guess I might be using the if else condition in an improper fashion.
    If the second LOV filter is not used.. I am matching the :LOV2 value with "%" and execute appropriate chart query based on single selection criteria and for the else case I use the other query and so on.
    I wish to show the code but since I upgraded to 3.0.1 today my application page views don't render properly. The images are missing ..and whole page is missing for editing.

  • Charts based on page items

    Hello,
    I want to create a Pie chart based on page items. There are 3 page items that I want to use for an Pie chart. The page items are calculated in an page process PL/SQL block and they are numbers. I want all PL/SQL in that page process and from there built the Pie chart. Is this possible to use the page items for the pie chart, I can only find information to build charts with querys.
    I use apex 4
    Edited by: Martijn Brands on 1-sep-2010 2:46

    I have used an function with three values as input and returning an pl/sql table with the three values.

Maybe you are looking for

  • Too many sharepoints when connecting to server

    I have a 10.5.8 Tiger server. I am upgrading to the new Lion Server. I have setup the server, created users and groups and setup Sharepoints using the Server App. The problem is I have several sharepoints specific to certain groups. In Tiger the user

  • IChat stopped working last night on iPads and Mac

    Last night, while using iChat (beta) on my MBP to a friend's iPad, it studdenly stopped sending.  She called me to tell me that she suddenly couldn't send from her iPad, so I tried from mine.  She can't use iChat on her iPad, I can't on mine, I can't

  • Never ending restart after restore from 1.1.4 to 2.0.2

    restored it because i didn't want any of the music on it. so after restore completed it said restarting iphone, and it never restarted, so i soft restarted the phone, the lock and home button restart. and it ended up in a loop about every minute it r

  • 1182: Package cannot be used as a value

    Does anyone know what this error means? It popped up when trying to publish a piece of code: http://www.kirupa.com/forum/attachment.php?attachmentid=45100&d=1199733292 The swf file provided works, but a publish gives this error (and the resulting swf

  • Trouble signing in with OS X Yosemite

    I have OS X Yosemite and now I have to log into my computer twice before it opens.  The first time I type in my password, the little dots representing my password are black, then after I press enter I get a thin black bar towards the bottom of the sc