Dynamic Query in SVG Chart
Hi,
I have SVG Chart, Chart Type: Cluster Bar, Vertical. I have 4 Chart Series. First:
SELECT null link, X.MESIC
FROM [email protected]
WHERE ..........
I have given dynamic Chart Series Query:
'SELECT null link, X.MESIC
FROM '||adm||'.[email protected]
WHERE .........."
but Apex write error:
1 error has occurred
Failed to parse SQL query
Please help as in what am i missing?
You can either use a SQL query or a function returning SQL query as the source of your chart. Just adding some quotes to a query however doesn't make it dynamic nor a function. Try something like this:
begin
return 'select null, ename, sal from emp';
end;
Edit your existing chart source, and check "Save query without validation", so that APEX doesn't attempt to parse and validate the query when saving.
Hope this helps,
Marc
Similar Messages
-
hi...i'm relativly new in htmldb and i have some trouble to get an task, given by my boss, running.
the problem is, i want to create an sql-query using the values of some different elemnts on my page. to compine these values i use an process and this process filss an textarea (for testing) with an string that is an sql-query. now i want to tell the svg chart to use this string as datasource for the chart.
...as i said, i'm new. maybe the problem is trivial but i can't see the solving. so i would be happy to get an answer.Hi Sven,
Can you send the link of the previous topic you are referring to??? or elaborate as how you are building a function to return a query...
Thanks,
Swaroop -
Hi,
I am trying to build a page that displays an SVG pie chart with the following query:
SELECT '', "&P4_SHOW.", count(*)
FROM "MY_TABLE"
GROUP BY null, "&P4_SHOW."
ORDER BY "&P4_SHOW."
where P4_SHOW is a list of columns of the table 'MY_TABLE'.
However, I get the following error when I try to save the chart definition:
Query cannot be parsed, please check the syntax of your query. (ORA-01741: illegal zero-length identifier)
Thanks for your help.you're unfortunately not going to be able to build your svg chart off that query in the current build of html db. to explain the issue real quickly, P4_SHOW doesn't have state while you're working in the development environment. because of that, your query's being run as something like...
SELECT '', "", count(*)
FROM "MY_TABLE"
GROUP BY null, ""
ORDER BY ""
...and you'll get that same "illegal zero-length identifier" in sqlplus if you try to run it there. we'll hopefully be able address this issue in a post-production release of the tool, but the best work-around for now would be for you to add multiple svg regions to your page. have one region per column of MY_TABLE and conditionally display the appropriate region based on P4_SHOW.
hope this helps,
raj -
Unable to edit wizard created SVG chart query
Hi,
I have a problem with an SVG chart that one of the HTML DB wizards created.
On the generated page the wizard created a selection list item named P30_SHOW.
This item allows to choose a table column based on which an SVG pie chart is generated.
The automatically generated chart query is:
select 'f?p=106:26:&SESSION.:::RP,26:P26_CHART_FILTER,P26_VALUE:'||:P30_SHOW||','||"&P30_SHOW.",
"&P30_SHOW.", count(*)
from "TESTTABLE"
group by 'f?p=106:26:&SESSION.:::RP,26:P26_CHART_FILTER,P26_VALUE:'||:P30_SHOW||','||"&P30_SHOW.",
"&P30_SHOW."
The page with selection list and chart worked fine at first.
But then, when I edited the chart's width on the respective 'SVG Chart Attributes' tab and pressed
the 'Apply Changes' button I got the following error:
'Query cannot be parsed, please check the syntax of your query. (ORA-01741: illegal zero-length identifier)'
I only changed the chart's width, I did not touch the chart's query at all.
My theory is that HTML DB tries to validate the correctness of the chart's query.
However, the query references a session variable (P30_SHOW) that is
not defined in my development session. Consequently, the query is not valid in the
development context and is refused by HTML DB.
Now I have two questions:
1. Is my analysis correct, or are there different reasons for the error I do encounter?
2. How can I get around the problem? I'd like to use the automatically generated charts,
but also want to be able to edit them.
Thanks in advance for helpful comments.
Regards HolgerScott,
I imported the application using the import/install process. A new application ID was created but was not changed in the chart query. The link was generated by the application wizard. The chart query link is below:
select 'f?p=103:2:&SESSION.:::RP,2:P2_CHART_FILTER,P2_VALUE:'||:P6_SHOW||','||"&P6_SHOW.", "&P6_SHOW.", count(*)
from "O_DATA_COLLECTION_POINTS"
group by 'f?p=103:2:&SESSION.:::RP,2:P2_CHART_FILTER,P2_VALUE:'||:P6_SHOW||','||"&P6_SHOW.", "&P6_SHOW."
The new application id is 101. It is impossible to modify this query because of message:
"1 error has occurred
Query cannot be parsed, please check the syntax of your query. (ORA-01741: illegal zero-length identifier"
This happens even if nothing is changed in the query but just the apply changes button is pressed.
I had a similar problem with the breadcrumbs menu. The link was also pointing to the old application id 103 instead of the new application id 101. The way I got round that was to delete the breadcrumb template and create a new one. I then had to go through all the pages that referenced that and reset the breadcrumbs menu template in the region definition.
Thanks Arjen -
Dynamic Query Data issue...Apex Charts
Database version and APEX version are in the tags...11g and4.1.2
I have data in this format
NODE_NAME
REPORT_DATE
STORAGE_AMOUNT_ALLOC
Anole
01/01/2013
3175
Fiji
01/01/2013
0
Anole
02/01/2013
3175
Fiji
02/01/2013
0
Anole
04/01/2013
3276
Fiji
04/01/2013
0
Anole
05/01/2013
3276
Fiji
05/01/2013
0
Anole
06/01/2013
3276
Fiji
06/01/2013
0
I've build a Dynamic query which returns:
SELECT NULL LINK,report_date DATIME,decode(NODE_NAME,'Anole',STORAGE_AMOUNT_ALLOC)"Anole",decode(NODE_NAME,'Fiji',STORAGE_AMOUNT_ALLOC)"Fiji" FROM STORAGE_REPORTS WHERE report_date between to_date('01-JAN-2013','DD-MON-YYYY') and to_date('01-JUN-2013','DD-MON-YYYY') and (INSTR(':Anole:Fiji:', ':'||NODE_NAME||':') > 0) ORDER BY report_date ASC
The resultant data is
LINK
DATIME
Anole
Fiji
01/01/2013
3175
01/01/2013
0
02/01/2013
3175
02/01/2013
0
04/01/2013
3276
04/01/2013
0
05/01/2013
0
05/01/2013
3276
06/01/2013
3276
06/01/2013
0
When I put the above query to the chart it give me accurate series with one..however when I add a second NODE to the query it completly hacks the chart. I have a feeling this is because I have repeating dates and it doesn' know how to handle this. So I'm wondering how I get rid of the repeating dates. and make them all one row with columns for each series.
Thanks
Robapex version? database version?
if you're on 11g, it sounds like you want the PIVOT command.
you should also post a simple CREATE TABLE and a few INSERT statements so others can test.
select null link
,report_date as datime
,"Anole", "Fiji"
from ( select REPORT_DATE, NODE_NAME, STORAGE_AMOUNT_ALLOC
from STORAGE_REPORTS
PIVOT (
sum( storage_amount_alloc )
for (node_name)
in ( 'Anole' "Anole", 'Fiji' "Fiji" ) -- rename columns here
where report_date between to_date('01-JAN-2013','DD-MON-YYYY') and to_date('01-JUN-2013','DD-MON-YYYY')
order by report_date asc -
Hi,
I cause the following error to be raised when trying to save (Apply Changes) the query for an SVG chart:
ORA-20001: set_attribute error: ORA-01461: can bind a LONG value only for insert into a LONG column
The query just got 'longer' which prompts the question:
Is there an upper limit to the length (number of characters) of the query ?
Thanks for all and any help,
sinclairI cannot answer your direct question, but if your SELECT statement is hard-coded and not generated from PL/SQL, I can offer a possible work around. You could create a database VIEW using your SELECT statement and query the view in your SVG chart.
Mike -
SVG Chart - Dynamic Where clause
Hi,
I am trying to use SVG Chart to show some data as a line graph. It is working great when the SQL is static. I need to allow user to filter the data using a where clause on a date column. I looked at the sample application and found drill-down chart which is doing the filtering.
I get a "No data found" when I do a similar thing. The difference being -
1. I have a date field, where user selects a date & presses Go.
2. SQL in SVG reads - SELECT null, to_char(repdate,'HH24:MI') rep_date, 100-i Value from t WHERE repdate = :P6_Date order by repdate
This is on Page 6
Can somebody please point out what am I doing wrong ?
Thanks !
VKSVijay,
As a test, try to pass a formatted date string into the page in the URL. If the chart renders, my guess would be that when you operate the page the way you described (select date then press Go) the date value isn't stored in session state for the SVG chart region to access. You would need to submit the page to make that happen, then branch back to the page to render the chart region and perhaps make that region display conditionally based on whether the filter value had been set.
Scott -
SVG: Chart error: ORA-20001:
Hi,
We are using 1.6.1.00.02 . I got a problem with SVG chart. The query returns following error:
SVG: Chart error: ORA-20001: bar_char_error ORA-20001: get_data_error: ORA-20001 Fetch error: ORA-01782
The column names are correct. The same query works perfectly in HTMLDB reports.
Following is the query:
SELECT
TRANSACTION_dATE,
SUM(SALES) SALES,
SUM(COST_OF_SALE) COST_OF_SALE
fROM HTML_SALES_REPORT_View
WHERE transaction_date between
'01-DEC-2004' and '31-DEC-2004'
GROUP BY TRANSACTION_DATE
Help will be appreciated.
Regards,
HamayunHi,
you have to use the following syntax:
SELECT link, label, value
Example
SELECT
null link, TRANSACTION_dATE label,
SUM(SALES) value ,
fROM HTML_SALES_REPORT_View
WHERE transaction_date between
'01-DEC-2004' and '31-DEC-2004'
GROUP BY TRANSACTION_DATE
And to display your cost_of_sale data you have to add a second series like this:
SELECT
null link, TRANSACTION_dATE label,
SUM(COST_OF_SALE) value
fROM HTML_SALES_REPORT_View
WHERE transaction_date between
'01-DEC-2004' and '31-DEC-2004'
GROUP BY TRANSACTION_DATE
because you can't display two lines with just one query.
I hope this will help.
Regards, Jörg -
SVG CHart error ORA-20001 with Stacked Bar Chart HTML DB 1.6.0.00.87
Hi,
during I put a How-To into execution (How To Create a Stacked Bar Chart) I'll get the following error code:
SVG Chart error:ORA-20001:line_Chart error:ORA-20001:
get_data error:ORA-20001:Parse error:ORA009
(see http://www.oracle.com/technology/products/database/htmldb/howtos/index.html)
This Situation occurs when i add a second series to the
chart. The first series works fine. I've used the following SQL-Statement:
select null l, sales_month, revenue from (select to_char(o.order_timestamp,'Mon YYYY') sales_month, sum(oi.quantity * oi.unit_price) revenue, to_date(to_char(o.order_timestamp,'Mon YYYY'),'Mon YYYY') sales_month_order from DEMO_PRODUCT_INFO p, DEMO_ORDER_ITEMS oi, DEMO_ORDERS o where o.order_timestamp <= (trunc(sysdate,'MON')-1)and o.order_timestamp > (trunc(sysdate-365,'MON'))and o.order_id = oi.order_id and oi.product_id = p.product_id and p.category = 'Audio' group by to_char(o.order_timestamp,'Mon YYYY') order by sales_month_order);
Please help.
Regards
DetlevWell,
I've just been struggling for a couple of hours with a cluster bar chart giving the same problem.
The problem is definitely with "ORDER BY".
I guess the graphing chart is taking the sql query as a string and then does some other manipulation on it which ends abnormally when you include the order by clause.
I presume that if you embed the query in a
SELECT * FROM (<actual query with order by>)
it might mitigate the problem.
Bye,
Flavio -
I'm a newbie.
I've created a 2-series line chart (thanks to someone else's query on this forum, I found out about losing the 'order by' for multiple series!). I only have 2 'X' categories at present ('quarter1' and 'quarter2') but the chart defaults to squeezing them together at the left-hand side, leaving enough room to go up to about quarter 15, but I will only ever want 4.
Anyone know how the spread the categories across the axis?
Thanksassuming you're talking about the legend when you say, "but the chart defaults to squeezing them together at the left-hand side, leaving enough room to go up to about quarter 15", then know that this is a current limitation. i'll log the enhancement request in a bit (unless we already have that one), but consider unchecking the "Show Legend" box on your SVG Chart Attributes screen and just drawing your own for now. if you were asking about something else, please do feel free to elaborate.
regards,
raj -
Hi everybody,
I have I think a simple question but I don't find the issue.
I've created a SVG Chart with 3 Series Name Query. I need to see 3 Series based on Month. My month is on 2 digit : 10 for October, 11 for November...Etc...but for this case, on my graph I see 11 before 10 on the Axis area. Could you tell me where can I make an order on my query ? I tried to add order by on my 3 query but It doesn't work and my graph is grey.
I'm sorry for my english.
OlivierThank you for your reply, find below my 3 queries
Series Name Query
1.
select null link, d.month, sum(data.nbr) Delivered
from online_data data, online_date d
where data.date_events = d.date_events
and data.kpi_id = 2
group by d.month
2.
select null link, d.month, sum(data.nbr) Opened
from online_data data, online_date d
where data.date_events = d.date_events
and data.kpi_id = 4
group by d.month
3.
select null link, d.month, sum(data.nbr) Submited
from online_data data, online_date d
where data.date_events = d.date_events
and data.kpi_id = 5
group by d.month
The field Month is a numeric field : 1 / 2 / 3...until 12 for month
But my graph is like this
http://img47.xooimage.com/files/e/7/3/chart-8b04ad.png
You can see that my graph start with 11 on axis area and finish with 10...il would like to order by ASC
Edited by: user1642453 on Dec 3, 2008 6:41 AM -
Hi Friends,
Thanks for sparing your valuable time i watching this thread.
I had a table with values of amounts where some values are negative also. Now I want to display those values in a Chart. I tried with the SVG Chart where it is not allowing me to start the axis with negative amount. It is prompting to enter either 0 or greater than that to start with.
Can anyone tell me which chart is best feasible to display with the following items:
I have 13 Categories (Static), Months (Dynamic, atleast 30 months will be there), Amounts for each category for each month.
I need to display this in the chart so as to better know the burn rate.
Thanks,
Sekhar.All browsers have SVG support built-in now, except for Internet Explorer that needs help. The Adobe SVG Viewer is just one of the options for that help, it is no longer supported officially, but you can still download it.
Going from SVG to Flash is throwing out much of the power you get from the openness. -
Has anyone experienced the following. We have SVG graphs that displays hours by week for the last 15 weeks on a page. They displayed correctly in 10g, but after an upgrade to 11g, the weeks are out of order. We made sure that there is an order by clause in the query for the chart series. After doing this, the charts do not display. If you had this issue, what did you do to resolve it?
Thanks
KevinJohn,
That is correct. There were no order by clauses in the code to begin with. I inherited this application not to long ago. I tried your suggestion and get the same results. Maybe I am doing something wrong.
This works with the dates being scattered as to order.
select
null link,
ACTIVITY_MASTER.ACTIVITY_DATE Week,
NVL(SUM(ACTIVITY.HOURS),0) Hours
from
ACTIVITY_MASTER,
ACTIVITY
where
ACTIVITY_MASTER.NAME = :P510_NAME and
ACTIVITY_MASTER.ID = ACTIVITY.ACTIVITY_MASTER_FK(+) and
to_date(ACTIVITY_MASTER.ACTIVITY_DATE + 7) > to_date(sysdate - 98)
group by ACTIVITY_MASTER.ACTIVITY_DATE
This fails to draw a chart
select
null link,
ACTIVITY_MASTER.ACTIVITY_DATE Week,
NVL(SUM(ACTIVITY.HOURS),0) Hours
from
ACTIVITY_MASTER,
ACTIVITY
where
ACTIVITY_MASTER.NAME = :P510_NAME and
ACTIVITY_MASTER.ID = ACTIVITY.ACTIVITY_MASTER_FK(+) and
to_date(ACTIVITY_MASTER.ACTIVITY_DATE + 7) > to_date(sysdate - 98)
group by ACTIVITY_MASTER.ACTIVITY_DATE
order by ACTIVITY_MASTER.ACTIVITY_DATE
Kevin -
Svg charts - size and default value
is there any way to make svg chart size smaller? i want to fit 6 graphs onto a page and even with the 350x315 setting, they are still too big
also, when i have a query like this:
select null, c.nodes, count (*)
from customers c, country_region_mapping m
where system_status='Production'
and c.country = m.country
and decode(:P4_REGION, '%', 1, m.region, 1, 0)=1
and decode(:P4_COUNTRY, '%', 1, m.country, 1, 0) =1
and decode(:P4_INDUSTRY, '%', 1, c.industry, 1, 0) =1
group by nodes
the page initially comes up empty. in other words, the charts have no data.
is there anyway to default to alli'm currently checking on your question about the chart sizes, but the second part of your question sounds easy enough. it looks like your query will return all the rows "from customers c, country_region_mapping m where system_status='Production' and c.country = m.country" when the default values of :P4_REGION, :P4_COUNTRY, and :P4_INDUSTRY are '%'. if that's how you're going about things, you can simply set your defaults for these items to the percent sign in those items' respective definition screens. this way, even before your items get a session state value, they'll be assigned their default "%" values and your query will return rows.
i'll get back to you soonish re the svg chart sizes,
raj -
Hi everybody!
I am playing a little bit with charts at the moment.
Therefore I created a query, which takes app. 2 seconds in the SQL Command Processor.
Then I created a region with a pie chart (SVG chart).
When I run the page, it takes several minutes until the chart appears (it is unacceptable).
1.) Does anybody have an idea, why this takes so long?
2.) Has anybody a better understanding of the SVG charts? How is the chart created, when the query was run? Is it created within the webserver and just displayed in the browser plugin? Or does the webserver just prepare some data and the chart is created within the browser plugin?
3.) How can I improve the performance of creating SVG charts?
4.) Are there other possibilities existing for creating charts?
Thank you for your help in advance and best regards,
ChristianHi Christian,
There may be lots of issue about the performance of the SVG chart.As far my knowledge goes you must have install Adobe SVG Viewer to the local machine for the browser to initiate HTMLDB Webserver (which is nothing but PL/SQL embedded gateway accessed through MOD_PL/SQL) with the chart viewer plugins.Now if u have so complex query with huge records ,aggregate function and group by that might be a performance issue in case of SVG.
May be some guys from HTMLDB Team can direct us......
Cheers,
ROSY
Maybe you are looking for
-
Full path for images automatically?
Hi - We do HTML for emails (i.e. - viewed in an inbox NOT a browser, per se) so every document I create needs to have the full URL path. i.e. - http://www.servername.com/images/picture.gif The Site Definition (Advanced Tab) allows me to make my image
-
Hey guys. I have a application developed to tomcat, I can deploy it ok in my OC4J 10.1.2.0.2. But the application has some "hardcoded" URL to search the servlets like this /servlet/co.com.pragma.eo.servlets.usuarios.activacion.UbicarUsuarioEnEnlace T
-
Videos online won't work on my new 2013 13" Macbook Pro
Wifi works perfectly but videos won't show up. Youtube, Hulu+, etc all don't work-- every time I load a page with a video on it, the place where the video is displayed just shows a black square. Nothing happens when I refresh the page/quit out/click
-
How do i setup Mail account on my mac book like in mobile phone? I.e. Don't want to store the mails/attachments on pc, however need the latest emails for given number of days? This helps the storage and purpose of email as well. I could always log in
-
hi I am having a doubt in Idoc in creating Model view. I had made a Z-segment,infotype,message type & in WE82 had assigned the infotype to message type. But when i m craeting am model view I am trying to add ths z message type to model view,its not s