Flash Chart Series : SQL Query Validation
Hello,
I probably found a bug on the SQL Query Validation for Flash Charts, if I have two subqueries, the validation fails:
SQL Query example:
SELECT NULL, a, b
FROM (SELECT c a, d b FROM
( SELECT 'first' c, 2 d FROM DUAL))
Error returned:
"Failed to parse SQL query:
ORA-06550: line 1, column 45: PLS-00428: an INTO clause is expected in this SELECT statement"
Is this problem known or is there just something that I do wrong ?
Christophe
Yes it was that problem, but I still have an issue:
How do I set the Flash Chart to use a PL/SQL function in the first place ?
When I try to enter:
"return package.function;" in the Create Region Wizard, I get the following error:
Failed to parse SQL query:
return EXPERT.getFullListSQLByNC
ORA-00900: invalid SQL statement
Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).
Similar Messages
-
Hi I am trying a plot a graph using the values from one of my table.
I am filtering the data using timestamps.
When I use direct SQL against the database it is retrieving all the data.
However When I am using the same SQL query to plot a 2D line Graph it is not using all the values to plot the Chart.
Any ideas.
Thanks
BalajiHello,
Have a look at the serie where you defined the sql statement.
You probably have a max there of 15 records. You need to increase that value to for ex. 50.
Regards,
Dimitri
http://dgielis.blogspot.com/
http://www.apex-evangelists.com/ -
2D Column Flash Chart - Series Showing Zero Values in Chart
Hi,
I have created a 2D Column Flash Chart - with 6 series with different coloring of bars..I have obtained the result as I wanted.
Now the problem is the distance between one series to another series is filled up with value 0.
Anybody please help me remove the 0 value in chart which is coming between series.
Thanks
JPHello,
I guess you must have data that reflect the 0 value, no?
In your query can you do WHERE value <> 0, so they don't get taken into account or is it the purpose to keep them in?
Thanks.
Regards,
Dimitri
http://dgielis.blogspot.com/
http://www.apex-evangelists.com/ -
Populate chart using sql query
Hello,
I have some sql queries that I run in a database. This queries uses the "Sum case" method.
I'm trying to create a rdlc file in order to report a pie chart.
But I don't know how can I configure the Chart on the rdlc file to get the data.
My queries are like this:
Dim Pesquisa As String = "SELECT Origem," _
& " SUM(CASE WHEN Qualidade_Passagem = 'Otimo' THEN +1 ELSE 0 END) AS Otimo ," _
& " SUM(CASE WHEN Qualidade_Passagem = 'Bom' THEN +1 ELSE 0 END) AS Bom ," _
& " SUM(CASE WHEN Qualidade_Passagem = 'Regular' THEN +1 ELSE 0 END) AS Regular," _
& " SUM(CASE WHEN Qualidade_Passagem = 'Ruim' THEN +1 ELSE 0 END) AS Ruim" _
& " FROM Atendimentos where Data Between '" & Datainicial.Date.ToString("MM/dd/yyyy") & "' and '" & Datafinal.Date.ToString("MM/dd/yyyy") & "'" _
& " GROUP BY Origem" _
& " ORDER BY 1"
But I can't insert this query in the right place...
How can I do that?
ValdirnmHi Governm,
Per my understanding that you want to make the query to execute and get the correct fields which will use in the pie chart, right?
You query is like below:
SELECT Origem,
SUM(CASE WHEN Qualidade_Passagem = 'Otimo' THEN +1 ELSE 0 END) AS Otimo ,
SUM(CASE WHEN Qualidade_Passagem = 'Bom' THEN +1 ELSE 0 END) AS Bom ,
SUM(CASE WHEN Qualidade_Passagem = 'Regular' THEN +1 ELSE 0 END) AS Regular,
SUM(CASE WHEN Qualidade_Passagem = 'Ruim' THEN +1 ELSE 0 END) AS Ruim
FROM Atendimentos where Data Between Datainicial.Date.ToString("MM/dd/yyyy") and Datafinal.Date.ToString("MM/dd/yyyy")
GROUP BY Origem
ORDER BY 1
Generally, when create an dataset of an RDLC report, a dataset specifies the data that you want to use from a data connection. A dataset is based on a data connection that has been saved in the report as an embedded data source or a reference to
a shared data source on a report server. The dataset includes a query that specifies a set of fields. As you drag these fields to the design surface, you create expressions that evaluate to the actual data when the report runs.
If you right click the DataSource and select the DataSet found there is nowhere to add an query, you can reference to article below which contains the sample code to help add the query successfully(You can add the code to the .aspx file):
http://technet.microsoft.com/en-us/library/aa337091(v=sql.100).aspx
http://go4coding.com/post/2011/06/07/Using-Sql-Server-Reporting-services-in-ASP-net-web-Application.aspx
If you still have any problem, please feel free to ask.
Regards
Vicky Liu -
SQL query validation with XML?
Hi
Is there anything out there that will validate an SQL statement (validate meaning the SQL statement 'will run') using XML?
I want to make a servlet that takes SQL and adds it to a java class that will in turn do a bunch of magical things. However
I need the SQL to be validated before it gets written to the class.
XML seems like it would be a useful tool to accomplish this but I fear the
document would be friggen huge and run slow as hell.
I guess in essence it would be like creating an SQL compiler completely
out of XML.
Does something like this exist or is this solution just to broad to realistically consider?There is no kind of relashionship between SQL and XML. Moreover, with RDBMs having different flavors of SQL, how can you expect an XML parser to be able to tell you that your query will run on Oracle but non on SQL Server?
-
The table on whichn chart is build as a columns namely cen_name,track_name,quantity
dispatch_date.My requirement is to build a
chart which shows me monthwise the tracks
dispatched,so i wrote the query
select
null the_link,
ce_cur_tk_cen_track_id the_name,
qnty the_data
from atcmis.courseware_reqs
where to_char (DISP_DATE,'MON-YY')=:dispdate
however the output shows the same track getting repeated in caseof dispatch to different centers having the same track,in the same month,my need is however only to list trackwise quantity dispatched .
Where for example if 20nos.of track X is dispatched to center A in april and 30 nos.
of same track X is dispatched to center B in april then i want the chart to display only one track X display with 50 nos.
how do i do this?Pls check the same query at SQL promt. The chart will be rendered accordingly.
Maybe you will need to change your query. -
Using 'Function Returning SQL Query' with Flash charts
I have created a pl/sql function that returns a SQL query as a varchar2 of this form:
select null link
<x value> value
<Series1 y value> Series 1 Label
<Series2 y value> Series 2 Label
<Series3 y value> Series 3 Label
from tablea a
join tableb b
on a.col = b.col
order by <x value>
If I now call the function from a Flash Chart Series SQL box with the Query Source Type set to 'Function Returning SQL Query' like this:
return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'))
it parses correctly and the page is saved; however, when I run the page I don't get any output - nor any error messages or other indication of a problem.
Now, if I call the function in a SQL client, capture the SQL query output using dbms_output and paste that into the Flash Chart Series SQL box - changing the Query Source Type to SQL Query - and save the page it works fine when I run it and returns a multi-series flash chart.
Can anyone suggest either;
1. What have I might have missed or done wrong?
2. Any way to usefully diagnose the problem...
I have tried using the Apex debugger - which is very nice, by the way - but it doesn't provide any info on what my problem might be. I even tried writing my own debug messages from my function using the apex_debug_message package - got nothing...
Thanks,
EricHi Eric,
Try expressing the source as this:
begin
return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
Hope this helps,
John
If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well. -
Maximum row setting in flash chart
I created a flash chart using sql query and the row size was limited to 20.. how do change this default row size. I checked the chart attributes and region definition page. Obviously I am missing an apparent link.
I have seen an option for SVG chart however I dont find any for flash chart. Thanks in advance .
Message was edited by:
aruArumugam,
Edit the attributes for your chart series -- it is below the SQL.
- Marco -
Retrieve a range of records from SQL query Oracle
I want to retrieve range of rows in Oracle database. This is the table structure:
CREATE TABLE ACTIVESESSIONSLOG(
ASESSIONID VARCHAR2(30 ) NOT NULL,
USERID VARCHAR2(30 ),
ACTIVITYSTART TIMESTAMP(6),
ACTIVITYEND TIMESTAMP(6),
ACTIVITY CLOB
/This is the SQL command that I use to get rows from the table:
SELECT * FROM ACTIVESESSIONSLOG WHERE ROWNUM >= 5 AND ROWNUM <= 10 ORDER BY USERID ASC;When I rum it no data is displayed. What is the proper way to get only 5 rows from the database?
Best wishes
PeterIs this SQL query valid?I tend to say no: ORDER BY is applied last, so your rownum is not in correct anymore:
SQL> select rownum, ename, empno from emp order by empno
ROWNUM ENAME EMPNO
3 SMITH 7369
4 ALLEN 7499
5 WARD 7521
6 JONES 7566
7 MARTIN 7654
8 BLAKE 7698
9 CLARK 7782
2 SCOTT 7788
10 KING 7839
11 TURNER 7844
12 ADAMS 7876
1 JAMES 7900
13 FORD 7902
14 MILLER 7934
14 rows selected.You either use analytic ROW_NUMBER() as in my previous post - or you need to nest once again:
SQL> select rn, empno, ename
from (select rownum rn, ename, empno
from ( select ename, empno
from emp
order by empno))
where rn between 4 and 5
RN EMPNO ENAME
4 7566 JONES
5 7654 MARTIN
2 rows selected. -
Can anybody explain why a Line chart comprising of more than one Chart Series does not work when building the SQL constructed in PL/SQL ?
The second series is identical apart from the snapshot_ids.
I need to construct like this due to another problem with database links.
I''ve tried to trace this but nothing much is produced, maybe because of the SVG plug-in?
DECLARE q varchar2(1000);
BEGIN
q:='SELECT Snap_Time, Snap_TimeXX, Value
FROM (
SELECT TO_CHAR(S2.SNAP_TIME,''D'') Snap_Time,
TO_CHAR(S2.SNAP_TIME,''D'') Snap_TimeXX,
SUM(S.value) Value
FROM STATS$SYSSTAT S,
STATS$SNAPSHOT S2
WHERE S.SNAP_ID=S2.SNAP_ID
AND S.SNAP_ID between 832 and 859
AND S.INSTANCE_NUMBER=1
AND S.NAME=''execute count''
group by TO_CHAR(S2.SNAP_TIME,''D''))';
RETURN q;
END;Yes it was that problem, but I still have an issue:
How do I set the Flash Chart to use a PL/SQL function in the first place ?
When I try to enter:
"return package.function;" in the Create Region Wizard, I get the following error:
Failed to parse SQL query:
return EXPERT.getFullListSQLByNC
ORA-00900: invalid SQL statement
Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source). -
Function returning SQL query for mutiple series in a chart
Hi,
I would like to know if there is a way to specify a single PL/SQL function returning the queries for multiple series in a 2D Line Flash Chart. I have multiple series in my chart that has different values in the where clause. I can write a PL/SQL function that can return all these queries in one shot. Is there anyway that I can specify this function as returning the queries for all the series in the chart?
As an example, assume that I am using the following three queries for the series in my chart:
select deptno, count(*) from emp where deptno = 10 group by deptno
select deptno, count(*) from emp where deptno = 20 group by deptno
select deptno, count(*) from emp where deptno = 30 group by deptno
I can't write a PL/SQL function that returns a query in the multiple series syntax (SELECT link, label, series_1_value [, series_2_value [, ...]]FROM ...) as I am using an aggregate function and my where clause is different for each series.
Thanks,
RupeshHi Roel,
Thanks for your reply. I am already using an analytical function (RATIO_TO_REPORT(COUNT(*)) OVER () ) in my actual report. My problem is that the query for one series differs from the other only in one where clause. I will be able to dynamically able to generate all the queries for all the series in one pl/sql function. But the chart definition screen does not allow us to define a single function that returns queries for the all the series - possibly seperated by some seperator like S1: select.... S2:select and so on.
Regards,
Rupesh -
Flash chart with dynamic sql query does not display
Hi,
In my schema SIVOA I have a lot of tables declared like this :
CREATE TABLE "SIVOA"."EVV_xxxx"
( "CLEF_VAR" NUMBER(4,0),
"DATE1" DATE,
"VALEUR" NUMBER(16,8) Only the last part of the name changes "xxxx". For example E009, E019, etc....
I am making a chart page with report and want the user to select a name of a table and I will display using dynamic sql query, the table report and chart.
P184_ENAME is a select list returning the last part of the name of the table, fro example 'E009', 'E019', etc.
P8_CLEF_VAR is an item containing a value. This value is a key retrieved like this :SELECT CLEF_VAR
FROM SIVOA.SITE_ECHELLE
WHERE SITE = :P184_ENAMEI built a classic report using a sql dynamic function :DECLARE
x VARCHAR2 (4000);
BEGIN
x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
|| UPPER(:p184_ename)
|| ' WHERE CLEF_VAR = :p8_clef_var' ;
RETURN (x);
END;:p8_clef_var is an itme containing the value '4544'.
This works perfectly fine !
When I use this sql fucytion into a flash chart it does not work. I get this message "No data found".
I do not understand why a the report get a result and not the chart !
But if i hard-code the number of the CLEF_VAR instead of fetching it from :p8_clef_var I get a nice chart ! Go figure !DECLARE
x VARCHAR2 (4000);
BEGIN
x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
|| UPPER(:p184_ename)
|| ' WHERE CLEF_VAR = 4544 ' ;
RETURN (x);
I cannot stay with the key (CLEF_VAR) hard-coded unformtunately !
My question is how to get the chart displaying properly ??
Thank you for your kind answers.
ChristianAlex,
Using your request, with the classic report I get results (data), but I get the same message with the Flash chart : "No data found" ! I don't know how to investigate this. i tried many things but nothing works.
Christian
PS I tried this :
DECLARE
X VARCHAR2 (4000);
BEGIN
x := 'SELECT NULL, DATE1, ROUND(VALEUR,2) FROM SIVOA.EVV_'
|| UPPER (:p184_ename) ||
' WHERE CLEF_VAR = '
|| :p8_clef_var ||
' AND DATE1 BETWEEN TO_DATE ('''
||:P8_DATE_DEBUT||''', ''DD/MM/YYYY HH24:MI'') AND TO_DATE ('''
||:P8_DATE_FIN||''', ''DD/MM/YYYY HH24:MI'')'
RETURN (X);
END; But it does not work either. I could find that the SLQ syntax generated is good becaus I put it into an item which display the return done by the pls/sql.
What is sttange also with the classic report is that if I do click on next or previous to see another rows, I get the message "No data found". If I try to export the report I get an excel file with "No data fouid".
Does anybody already tried my "need" here ? i find strange thant I should not be the firs one trying to get a report an tables which name would be "dynamic".
Tahnk you.
Edited by: Christian from France on Feb 13, 2009 3:05 AM -
Chart with multiple series (SQL?)
Hello everyone,
I have an sql question relating to flash charts in APEX 3.
I have a table "TREND" that has data like this :-
WEEK LOCN COST
===== ==== =====
45........A......10
46........A......12
47........A......15
45........B......18
46........B......16
47........B......11
45........C......13
46........C......14
47........C......10
How do I create an sql statement that can compile multiple values for a chart at runtime. In other words I want a chart that can show three LOCN lines (A,B and C) over the WEEKs (x axis) in the table.
Using the standard chart source only gives one value on the chart ..........
SELECT NULL link, LOCN label, COST value FROM TREND
I need something like this ..........
SELECT link, label, value1, value2, value3 FROM TREND
But I don't know how to transpose my data into that format, can anyone help ?
I need my data to look like this I think :-
WEEK A B C
===== == == ==
45....10.18.13
46....12.16.14
47....15.11.10
Thanks,
Jack.Hi Jack,
you have 2 possibilities.
1) You can create 3 distinct series sql statements (with the "Add Series" button) where you restrict the query to LOCN. Disadvantage: The table is scanned 3 times.
2) You can create just one series where the distinct series values are mapped to columns. eg:
SELECT NULL AS LINK
, WEEK AS LABEL
, SUM(DECODE(LOCN, 'A', COST, 0)) AS A
, SUM(DECODE(LOCN, 'B', COST, 0)) AS B
, SUM(DECODE(LOCN, 'C', COST, 0)) AS C
FROM TREND
GROUP BY WEEKAdvantage: Table is just scanned once.
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/ -
Scatter plot using time series function - Flash charting
Apex 3 + XE + XP
I am trying to build a time series scatter plot chart using flash chart component.
Situation :
On each scout date counts are taken within each crop. I want to order them by scout dates and display them in a time series chart. Each series represents different crop.
I am posting the two series queries I used
Queries:
Series 1
select null LINK, "SCOUTDATES"."SCOUTDATE" LABEL, INSECTDISEASESCOUT.AVERAGECOUNT as "AVERAGE COUNT" from "COUNTY" "COUNTY",
"FIELD" "FIELD",
"VARIETYLIST" "VARIETYLIST",
"INSECTDISEASESCOUT" "INSECTDISEASESCOUT",
"SCOUTDATES" "SCOUTDATES",
"CROP" "CROP"
where "SCOUTDATES"."CROPID"="CROP"."CROPID"
and "SCOUTDATES"."SCOUTID"="INSECTDISEASESCOUT"."SCOUTID"
and "CROP"."VARIETYID"="VARIETYLIST"."VARIETYLISTID"
and "CROP"."FIELDID"="FIELD"."FIELDID"
and "FIELD"."COUNTYID"="COUNTY"."COUNTYID"
and "INSECTDISEASESCOUT"."PESTNAME" ='APHIDS'
and "VARIETYLIST"."VARIETYNAME" ='SUGARSNAX'
and "COUNTY"."COUNTNAME" ='Kings' AND CROP.CROPID=1
order by SCOUTDATES.SCOUTDATE' ASC
Series 2:
select null LINK, "SCOUTDATES"."SCOUTDATE" LABEL, INSECTDISEASESCOUT.AVERAGECOUNT as "AVERAGE COUNT" from "COUNTY" "COUNTY",
"FIELD" "FIELD",
"VARIETYLIST" "VARIETYLIST",
"INSECTDISEASESCOUT" "INSECTDISEASESCOUT",
"SCOUTDATES" "SCOUTDATES",
"CROP" "CROP"
where "SCOUTDATES"."CROPID"="CROP"."CROPID"
and "SCOUTDATES"."SCOUTID"="INSECTDISEASESCOUT"."SCOUTID"
and "CROP"."VARIETYID"="VARIETYLIST"."VARIETYLISTID"
and "CROP"."FIELDID"="FIELD"."FIELDID"
and "FIELD"."COUNTYID"="COUNTY"."COUNTYID"
and "INSECTDISEASESCOUT"."PESTNAME" ='APHIDS'
and "VARIETYLIST"."VARIETYNAME" ='SUGARSNAX'
and "COUNTY"."COUNTNAME" ='Kings' AND CROP.CROPID=4
order by SCOUTDATES.SCOUTDATE' ASC
Problem
As you can see the observations are ordered by scout date. However when the chart appears, the dates dont appear in order. The chart displays the data from crop 1 and then followed by crop 4 data, which is not exactly a time series chart. Does flash chart support time series or they have no clue that the data type is date and it should be progressive in charting ? I tried to use to_char(date,'j') to converting them and apply the same principle however it did not help either.
Any suggestions ?
Message was edited by:
tarumugam
Message was edited by:
aruArumugam,
All labels are treated as strings, so APEX will not compare them as dates.
There are two workarounds to get all your data in the right order:
1) Combine the SQL statements into single-query multi-series format, something like this:
select null LINK,
"SCOUTDATES"."SCOUTDATE" LABEL,
decode(CROP.CROPID,1,INSECTDISEASESCOUT.AVERAGECOUNT) as "Crop 1",
decode(CROP.CROPID,4,INSECTDISEASESCOUT.AVERAGECOUNT) as "Crop 4"
from "COUNTY" "COUNTY",
"FIELD" "FIELD",
"VARIETYLIST" "VARIETYLIST",
"INSECTDISEASESCOUT" "INSECTDISEASESCOUT",
"SCOUTDATES" "SCOUTDATES",
"CROP" "CROP"
where "SCOUTDATES"."CROPID"="CROP"."CROPID"
and "SCOUTDATES"."SCOUTID"="INSECTDISEASESCOUT"."SCOUTID"
and "CROP"."VARIETYID"="VARIETYLIST"."VARIETYLISTID"
and "CROP"."FIELDID"="FIELD"."FIELDID"
and "FIELD"."COUNTYID"="COUNTY"."COUNTYID"
and "INSECTDISEASESCOUT"."PESTNAME" ='APHIDS'
and "VARIETYLIST"."VARIETYNAME" ='SUGARSNAX'
and "COUNTY"."COUNTNAME" ='Kings'
AND CROP.CROPID in (1,4)
order by SCOUTDATES.SCOUTDATE ASC2) Union the full domain of labels into your first query. Then the sorting will be applied to the full list, and the values of the second series will be associated with the matching labels from the first.
- Marco -
Flash chart performance issue with multiple series
Hi,
We have a problem with the performace of a line graph which has multiple series.
I have set up an example application here:
http://apex.oracle.com/pls/apex/f?p=37504:1
The application contains two charts. The 'Mulltiple Series' chart has twelve series behind it and allows the user to include mutiple series data. The other chart has just one series.
The single series chart takes only a couple of seconds to render, however the mutiple series chart takes around 10 seconds even when no additional series have been selected. Using Firebug I have observed that the apex_util.flash procedure is taking around 8 seconds to generate the XML, and it includes null data values for the series that aren't selected.
My question is how can I make each series conditional, such that no data is included in the XML if the series returns no rows?
Thanks,
AndrewHi Andrew
Have you considered modifying your chart to use a series with the "Query source type" of "Function returning SQL Query"
Have a look at
Re: Flash chart - multiple series - no display when some series empty
My response on that thread may help. I'd be interested to know if this approach improves the performance.
Kind regards
Simon Gadd
Maybe you are looking for
-
I have a macbook pro and I went on the adobe website but I can't find a download link to cs6 extended without buying it. I don't need to buy it because I already did and have the code but my mac doesn't have a cd tray so how am i suppose to put it on
-
I downloaded some podcasts, but I can't find them. Where are they?
I just downloaded 17 podcasts episodes. The iTunes confirms that they're in the iPhone (4S), but I can't find them. I already looked in the "Music" section, "More", etc. But the "Podcasts" item it's no there. Neither in the "Video" section. Do I need
-
Using Adobe form designer in ABAP Workbench
Hi, I am trying to do a POC on PDF generations from ABAP workbench( not from Net weaver developer studio) . Right now when I go into SFP transaction and clcik on layout tab it gives me error saying 'Error occured in communicating with layout ed
-
Since I switched to Ios 7, there is no search history in my safari. I tried everything, including deleting my iPhone and than restoring it, without any success. What am I missing that isn't recording my web history?
-
I have lost all my Bookmarks for Safari on my iMac (as well as on my iPhone). I was turning my iPad in to Gazelle.com for cash and was taking apps off of it. I wiped out something on it that affected my Safari Bookmarks, but I'm not sure what. I assu