Date Picker Result Used in Query for Flash Chart
Hello,
I'm creating a flash chart using an SQL Query. The query uses two date pickers for the beginning and ending date of the data the query returns. For some reason the substitution string for the data pickers do not work and do not return any data. If I hard wire the start and end date to something like '12/01/2008' and '01/31/2009' the query and the flash chart work just fine. When use the string representing the data pickers (:P65_BEGIN_DATE and :P65_END_DATE) the query does not return any data. Is there some problem using substitution strings in queries for flash charts??
For what it's worth here is the query. (Look near the bottom to see where I reference the data pickers):
SELECT 'Link',
to_char(Day, 'Mon DD'),
((Count("Item Number")-Sum("Devaition"))/Count("Item Number"))*100 as "Precentage"
from
(SELECT
to_date(concat(substr(F4140.PICSDJ, 1, length(F4140.PICSDJ)-3)+1900,
substr(F4140.PICSDJ, length(F4140.PICSDJ)-2,3)), 'yyyyddd') as Day,
F4141.PJLITM AS "Item Number",
sum(F4141.PJTQOH) AS "Sum Qty On Hand",
sum(F4141.PJTQCT) AS "Sum Qty Counted",
(decode(sum(F4141.PJTQOH)-sum(F4141.PJTQCT), 0, 0, 1)) as "Devaition"
FROM F4140 INNER JOIN F4141 ON F4140.PICYNO = F4141.PJCYNO
WHERE (((F4140.PICYCS) In ('40','50')) AND ((F4141.PJCCCD)='1'))
GROUP BY to_date(concat(substr(F4140.PICSDJ, 1, length(F4140.PICSDJ)-3)+1900,
substr(F4140.PICSDJ, length(F4140.PICSDJ)-2,3)), 'yyyyddd'), F4141.PJLITM
HAVING to_date(concat(substr(F4140.PICSDJ, 1, length(F4140.PICSDJ)-3)+1900,
substr(F4140.PICSDJ, length(F4140.PICSDJ)-2,3)), 'yyyyddd')
between to_date(:P65_BEGIN_DATE, 'DD-Mon-YYYY') and to_date(:P65_END_DATE, 'DD-Mon-YYYY') )
group by Day
I look at the debug output without changing anything and I am not really sure where the two date pickers are being populated. However I do have defaults set up for each datepicker of:
P65_BEGIN_DATE: to_char(sysdate - 30, 'DD-MON-YYYY')
P65_END_DATE: to_char(sysdate, 'DD-MON-YYYY')
and the dates I would expect show up in the date picker.
Also I created a Computation of Before Header type with the following PL/SQL expression:
to_char(sysdate-180, 'DD-MON-YYYY')
and I see the following output when in debug mode:
0.05: Computation point: BEFORE_HEADER
0.05: ...Perform computation of item: P65_BEGIN_DATE, type=PLSQL_EXPRESSION
0.05: ...Session State: Save "P65_BEGIN_DATE" - saving same value: "03-AUG-2008"
0.05: Processing point: BEFORE_HEADER
So I think the datapickers are being populated but the flash chart is still not working.
Similar Messages
-
consider this situation,
Two or more productid will be accquired by same customerid, by same shipvia, on the same day of the week of shipped date. i want the simple query for this.
my tables are from northwind:
[orders] = OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry.
[orders details] = OrderID, ProductID, UnitPrice, Quantity, Discount.
i tried some but it is not exact, it gives wrong result.
select pd.CustomerID,pd.ProductID, pd.no_of_time_purchased, sd.ShipVia, sd.same_ship_count, shipped_day from
select ProductID,o.CustomerID,COUNT(productid) as no_of_time_purchased
from orders o join [Order Details] od on o.OrderID=od.OrderID group by ProductID,o.CustomerID
having count(od.ProductID) >1) pd
join
(select OrderID,customerid, shipvia, count(shipvia)as same_ship_count, DATENAME(DW,ShippedDate)as shipped_day from orders
group by customerid, ShipVia, ShippedDate having COUNT(ShipVia) > 1 ) sd
on sd.CustomerID=pd.CustomerIDHi,
I think I have a solution that will at least give you a clue how to go about it. I have simplified the tables you mentioned and created them as temporary tables on my side, with some fake data to test with. I have incldued the generation of these temporary
tables for your review.
In my example I have included:
1. A customer which has purchased the same product on the same day, using the same ship 3 times,
2. Another example the same as the first but the third purchase was on a different day
3. Another example the same as the first but the third purchase was a different product
4. Another example the same as the first but the third purchase was using a different "ShipVia".
You should be able to see that by grouping on all of the columns that you wich to return, you should not need to perform any subselects.
Please let me know if I have missed any requirements.
Hope this helps:
CREATE TABLE #ORDERS
OrderID INT,
CustomerID INT,
OrderDate DATETIME,
ShipVia VARCHAR(5)
CREATE TABLE #ORDERS_DETAILS
OrderID INT,
ProductID INT,
INSERT INTO #ORDERS
VALUES
(1, 1, GETDATE(), 'ABC'),
(2, 1, GETDATE(), 'ABC'),
(3, 1, GETDATE(), 'ABC'),
(4, 2, GETDATE() - 4, 'DEF'),
(5, 2, GETDATE() - 4, 'DEF'),
(6, 2, GETDATE() - 5, 'DEF'),
(7, 3, GETDATE() - 10, 'GHI'),
(8, 3, GETDATE() - 10, 'GHI'),
(9, 3, GETDATE() - 10, 'GHI'),
(10, 4, GETDATE() - 10, 'JKL'),
(11, 4, GETDATE() - 10, 'JKL'),
(12, 4, GETDATE() - 10, 'MNO')
INSERT INTO #ORDERS_DETAILS
VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 2),
(5, 2),
(6, 2),
(7, 3),
(8, 3),
(9, 4),
(10, 5),
(11, 5),
(12, 5)
SELECT * FROM #ORDERS
SELECT * FROM #ORDERS_DETAILS
SELECT
O.CustomerID,
OD.ProductID,
O.ShipVia,
COUNT(O.ShipVia),
DATENAME(DW, O.OrderDate) AS [Shipped Day]
FROM #ORDERS O
JOIN #ORDERS_DETAILS OD ON O.orderID = OD.OrderID
GROUP BY OD.ProductID, O.CustomerID, O.ShipVia, DATENAME(DW, O.OrderDate) HAVING COUNT(OD.ProductID) > 1
DROP TABLE #ORDERS
DROP TABLE #ORDERS_DETAILS -
Two different results using one query
Hi Friends
Oracle version that I am using is : Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
I have a scenario where one account can be related to two customers. Hence, in table have many rows for one account. Here’s the sample data:
Account_ID | product_code | cust_id | relationship_code | entity_code
1111 | ABC | 1234 | SOL | CUST
1111 | ABC | 2222 | ZZZ | LINK
1111 | ABC | 4455 | ABC | LINK
2222 | ABC | 7890 | SOL | CUST
2222 | ABC | 5678 | ZZZ | LINK
3333 | JFK | 5878 | TST | CUST
3333 | JFK | 3254 | PRI | CUST
3333 | JFK | 3299 | PRI | CUST
4444 | JFK | 2535 | SOL | CUST
4444 | JFK | 4565 | SOL | CUST
5555 | DEF | 6666 | PRI | CUST
5555 | DEF | 6667 | TST | CUST
5555 | DEF | 9667 | TST | CUSTIn this scenario, I need two outputs differently:
Output 1: When an account has relationship_code = ‘SOL’ then take the least cust_id
1111 | ABC | 1234 | SOL | CUST
2222 | ABC | 5678 | ZZZ | LINK
4444 | JFK | 2535 | SOL | CUST Output 2: else take the highest cust_id
3333 | JFK | 5878 | TST | CUST
5555 | DEF | 9667 | TST | CUSTHow can I get this result using one query?Not sure what you mean. Works OK:
SQL> with t as (
2 select 1111 account_ID,'ABC' product_code,1234 cust_id,'SOL' relationship_code,'CUST' entity_code from dual union all
3 select 1111,'ABC',2222,'ZZZ','LINK' from dual union all
4 select 1111,'ABC',4455,'ABC','LINK' from dual union all
5 select 2222,'ABC',7890,'SOL','CUST' from dual union all
6 select 2222,'ABC',5678,'ZZZ','LINK' from dual union all
7 select 3333,'JFK',5878,'TST','CUST' from dual union all
8 select 3333,'JFK',3254,'PRI','CUST' from dual union all
9 select 3333,'JFK',3299,'PRI','CUST' from dual union all
10 select 4444,'JFK',2535,'SOL','CUST' from dual union all
11 select 4444,'JFK',4565,'SOL','CUST' from dual union all
12 select 5555,'DEF',6666,'PRI','CUST' from dual union all
13 select 5555,'DEF',6667,'TST','CUST' from dual union all
14 select 5555,'DEF',9667,'TST','CUST' from dual union all
15 select 6666,'XYZ',8877,'SOL','CUST' from dual
16 )
17 select account_ID,
18 product_code,
19 cust_id,
20 relationship_code,
21 entity_code
22 from (
23 select account_ID,
24 product_code,
25 cust_id,
26 relationship_code,
27 entity_code,
28 case max(case relationship_code when 'SOL' then 1 else 0 end) over(partition by account_ID)
29 when 1 then dense_rank() over(partition by account_ID order by cust_id)
30 else dense_rank() over(partition by account_ID order by cust_id desc)
31 end rnk
32 from t
33 )
34 where rnk = 1
35 /
ACCOUNT_ID PRO CUST_ID REL ENTI
1111 ABC 1234 SOL CUST
2222 ABC 5678 ZZZ LINK
3333 JFK 5878 TST CUST
4444 JFK 2535 SOL CUST
5555 DEF 9667 TST CUST
6666 XYZ 8877 SOL CUST
6 rows selected.
SQL> SY. -
How to use Results from Another Query for SAP BW universes
Hi Everyone,
I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding Sales doc no in first data provider.
I want to place all these fileds into a single report like as shown.
(Datarpovider1) (Datarpovider1) (Datarpovider2)
*Sales Doc No* Orderqty BillQty
Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
I tried it but it was giving the follwing error:
A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
All this I am doing in Webi Rich Client.
Appreciate your help
Thanks &in Advance
Kiran SakaHi Kiran,
I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
Regards,
Neeraj -
How to use dynamic query for Result table
Hello Experts,
I want to use dynamic query and then display the result in the assignment block.
Using dynamic query BTQAct and BTQRAct and base on some search criteria i want tofilter and then append the result in the result table of that custom context node, and then it should display the result in the view in UI.
SO can you please provide me the samplle code on how to use the dynamic query and append in the result table.
Regards.Hi,
Please find below sample code:
data: query TYPE REF TO cl_crm_bol_dquery_service,
result TYPE REF TO if_bol_bo_col.
DATA: lt_params TYPE crmt_name_value_pair_tab,
lwa_params TYPE crmt_name_value_pair.
query = cl_crm_bol_dquery_service=>get_instance( 'BTQAct' ). " Get instance of dynamic query
Set general query parameter for maximum number of hits
lwa_params-name = 'MAX_HITS' .
lwa_params-value = '50'.
APPEND lwa_params TO lt_params.
query->set_query_parameters( it_parameters = lt_params ).
query->add_selection_param( iv_attr_name = 'OBJECT_ID'
iv_sign = 'I'
iv_option = 'EQ'
iv_low = <lv_objectid>
iv_high = '' ). " Set your search criteria. Repeat this code if you have multiple parameters
"You can find possible search options for a query object in GENIL_BOL_BROWSER
result ?= query->get_query_result( ). " Get result from your search query
me->typed_context-> <your result context node>->set_collection( result ).
Here you will have to create a context node in your view which would refer to query result object like for BTQAct its BTQRAct
Hope this helps.
e Regards,
Bhushan -
Unable to set default date for Date Picker item using Auto Row Processing
Okay, I have searched through the forum for an answer, and have not found a thing to account for my problem.
First, does anyone know if using Auto Row Processing has problems updating an item/field in a record where the Source is defined as Database Column if the 'Display As' is defined as 'Date Picker (MM/DD/YYYY)'?
I ask this only because I found out the hard way that Auto Row Processing does NOT fetch the value for an item where the field is defined as TIMESTAMP in the database.
My problem is as follows: I have a form that will CREATE a new record, allowing the user to select dates from Date Pickers, text from Select Lists, and entering in text into a Textarea item. The information is saved using a standard (created through the Auto Row Processing wizared) CREATE page level button. After the record is created the user is able to go into it and update the information. At that time, or later, they will click on one of two buttons, 'ACCEPT' or 'DECLINE'. These are Item level buttons, which set the REQUEST value to 'APPLY' (Accept) and 'UPDATE' (Decline). The Accept button executes a Process that changes the Status Code from 'Initiated' to 'Accepted', and sets the Declined_Accepted_Date to SYSDATE, then another Process SAVEs the record. The Declined button runs a Process that changes the Status Code from 'Initiated' to 'Declined', and sets the Declined_Accepted_Date to SYSDATE, then another Process SAVEs the record.
However, even though the Status Code field is updated in the database record in both Accepted and Declined processing, the Declined_Accepted_Date field remains NULL in the database record (by looking at the records via SQL Developer). WHY??? I looked at the Session State values for both the Status Code and the Declined_Accepted_Date fields and saw that the fields (items) had the expected values after the process that SAVEs the record.
The following is the code from the Accept button Page Process Source/Process:
BEGIN
:P205_STATUS_CD := 'A';
:P205_REF_DECLINE_ACCEPT_DT := SYSDATE;
END;
As can be seen, the Status Code and Declined_Accepted_Date items are set one right after the other.
As an aside, just what is the difference between Temporary Session State vs Permanent Session State? And what is the sequence of events to differentiate the two?Here's yet another thing that I just looked into, further information...
One other difference between the date field I am having problems with (Accepted_Declined_Date), and other dates (with Date Pickers) in the record is that the Accepted_Declined_Date never gets displayed until after it is set with a default date when the Accept and Decline buttons are pressed.
One of the other dates that works, the Received Date, is able to write a default date to the record that is never typed into the box or selected from the calendar. That date is placed into the box via a Post Calculation Computation in the Source, which I set up as: NVL(:P205_REF_RECEIVED_DT,TO_CHAR(SYSDATE,'MM/DD/YYYY'))
However, I do remember actually trying this also with the Accepted_Declined_Date, and setting the Post Calculation Computation did not work for the Accept_Decline_Date. Could this be because the Accept_Decline_Date is never rendered until the Status Code is set to Declined (in other words, there is no need to display the date and allow the user to change it until the record is actually declined)???
The control of the displaying (rendering) of the date is set via the Conditions / Condition Type: Value of Item in Expression 1 = Expression 2
Expression 1 = P205_STATUS_CD and Expression 2 = L
Does this shed any light??? -
How to use dynamic query for this ??
hi , i am new to ABAP. i got a requirement to write dynamic query for the following code.
kindly address. two set of queries are same.but condition is different.
.IF p_psd EQ ' '.
*C--End of change DF 1232137- (Transport # :CIDK980530 )
*C--FETCH THE Deliverd Quantiity and Material Number
SELECT aufnr "ORDER number
wemng "Quantity of goods received for the order item
matnr "MATERIAL NUMBER
pwerk "PLANT
dauat "Order Type
FROM afpo
INTO TABLE t_afpo
WHERE aufnr IN s_order
AND wemng IN s_dqt
AND matnr IN s_matnr
AND pwerk IN s_plant
AND dauat = c_ro.
IF sy-subrc = 0.
SORT t_afpo BY aufnr matnr pwerk.
*C--FETCH THE OBJECT NUMBER
SELECT aufnr "ORDER number
objnr "Object number
FROM aufk
INTO TABLE t_aufk
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr.
IF sy-subrc = 0.
SORT t_aufk BY aufnr objnr.
*C--FETCH THE Target Quantiity
SELECT aufnr "ORDER number
gamng "Total order quantity target quantity
FROM afko
INTO TABLE t_afko
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr
AND gamng IN s_tqt.
IF sy-subrc = 0.
SORT t_afko BY aufnr .
ENDIF.
ENDIF.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
*C--Begin of change DF 1232137- (Transport # :CIDK980530 )
ENDIF.
IF p_psd EQ c_x.
SELECT aufnr "ORDER number
wemng "Quantity of goods received for the order item
matnr "MATERIAL NUMBER
pwerk "PLANT
dauat "Order Type
FROM afpo
INTO TABLE t_afpo
WHERE aufnr IN s_order
AND wemng > 0
AND matnr IN s_matnr
AND pwerk IN s_plant
AND dauat = c_ro.
if sy-subrc = 0.
*C--FETCH THE OBJECT NUMBER
IF NOT t_afpo[] IS INITIAL.
SORT t_afpo BY aufnr matnr pwerk.
SELECT aufnr "ORDER number
objnr "Object number
FROM aufk
INTO TABLE t_aufk
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr.
IF sy-subrc = 0.
SORT t_afko BY aufnr gamng.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF NOT t_afpo[] IS INITIAL.
*C--FETCH THE Target Quantiity
SELECT aufnr "ORDER number
gamng "Total order quantity target quantity
FROM afko
INTO TABLE t_afko
FOR ALL ENTRIES IN t_afpo
WHERE aufnr = t_afpo-aufnr
AND gamng <> t_afpo-wemng .
IF sy-subrc = 0.
SORT t_afko BY aufnr gamng.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSE.
MESSAGE text-e03 TYPE c_s. " No data for the selection criteria
LEAVE LIST-PROCESSING.
ENDIF.
Edited by: Thomas Zloch on Jan 5, 2011 1:30 PM please use code tagsHi friend,
Try using MACRO and dynamic WHERE condition.
Group simialr Select statements under a Macro.
Build a dynamic where by checking conditions
Call macro passing dynamic where condition.
TABLES afpo.
DATA: str TYPE string.
*Macro definition
DEFINE operation.
select single *
from afpo into afpo
where (&1). " Dynamic condition
END-OF-DEFINITION.
*Build dynamic WHERE by checking some conditions
*If conditon
CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0001''' INTO str SEPARATED BY space.
*Else
CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0002''' INTO str SEPARATED BY space.
*Endif.
*Call Macro passing dynamic WHERE condition
operation str. -
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. -
Read only date picker in an updatable query
Dear all,
There is a date picker component in my application. I need to disable data entry or any changes in a known condition. However when I create a dynamic action it only make the text field readonly.
__Please be advised that the date picker is in an up-datable query__ .
It also would be practical if I would be able to hide the javascript date picker button.
regardsSolved my problem by adding the following codes into the datepicker javascript:
if (document.getElementById(dateFieldName).readOnly)
return false; -
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 -
Setting the parameters for flash charts
Hi friends,
I am having a flash chart in one of my pages and the chart series is of type "Function returning the SQL query". the query is having some parameters like :P23_VARIABLE_NAME. The values of the variable is not getting passed on page load but the values will be passed only when we submit the form. The :P23_VARIABLE_NAME is a variable assigned to a list.
Could you please let me know how to pass the value to the flash chart the data. The variable values are passed on page load for some other charts which are on the page.
Regards,
PradeepThat was helpful information. I verified the session status for the page items and saw that when the page loads the session status is blank and when we submit the form the status changes to I with the corresponding values that I entered.
How can i set a default value for a page item so that when the page loads for the first time, The session status will be I and there is a default value for the page item.
One more observations is that even the session status is blank how is the apex reports fetching the data based on the variable and the chart is not able to fetch the data.
Could you provide some more light on the above two questions.
Regards,
Pradeep -
Hello everybody,
I'm trying to evaluate whether it's possible to use APEX for an application that I'm going to develop.
Therein I want to use several charts for displaying database content.
One of the charts I need is a combination of stacked charts with lines, but I can't find this type of chart in the "native" APEX-chart-collection. Is there anything available I missed at first sight?
Thanks in advanceMichael,
That is a limitation of APEX default charts which cannot combine types. However, the post by Dimitri Gielis might on [Anychart 5 integration kit for APEX|http://dgielis.blogspot.com/2008/11/anychart-5-integration-kit-for-apex.html] might be what you're looking for. This commercial version of AnyChart can do a lot of things including the combination of types you're looking for. BTW, the free flash chart in APEX is based on an older version of AnyChart.
Ittichai -
How do I use "Search Query" for nontrivial searches?
After a few years in the community, this is my _first_ question to the boards ;-)
In speaking with a colleague today, I learned about an NI forum feature that would be useful for me. When I tried to configure it, I then learned that I didn't know how to use it. When I tried to learn how to use it, I further learned that it wasn't fully documented. So, I'd like some clarification :-)
The feature in question is "Search Query" which will send you an email when a forum search matches your query. What I don't know is:
What are the rules (syntax) for search queries? For example, I would like to search for single words, all the words that I specify, as well as exact phrases. How do I differentiate between multiword queries and exact phrase queries?
Is it possible to have more than one Search Query?
If so, how do you delineate them? Would I use commas, a new line, something else?
I'm asking because the available (and discoverable) documentation doesn't mention what to do when you want more than one Search Query. The help text on the subscription page [1] makes me think that only one query is possible, and says a Search Query:
Sends you mail every time a message matching your query is submitted. Search queries take up to 15 minutes to take effect. Saving a blank query will disable this feature and will stop any mail from being sent.
The other place I tried was the NI Forum FAQ [2], which makes me think that more than one query is possible:
If you add a board, thread, message, or search term to your subscriptions, the system will send you an e-mail every time someone posts to the board, or replies to the message or thread. If you prefer not to receive an e-mail for your subscriptions, you can subscribe to the RSS feed of a board, thread, user, or search term.
The FAQ goes on about what to do with board, thread, and message subscriptions, but doesn't say anything more about search subscriptions.
The last place I looked was on the search results page itself. In the blue header that precedes the results, there's a link on the far left that says "Search Options" with a single option that says "Subscribe to this search's RSS Feed". While I could subscribe and use an RSS reader, I really would prefer email. I suppose if only one Search Query is possible, then this will be my workaround.
As a comment, why does the Search Options menu not also have a "Subscribe to this search" option, which would add another entry in the Search Query box? This is a noticeably different interface than the Thread Options menu.
[1] Subscriptions & Bookmarks
http://forums.ni.com/ni/user_subscriptions
[2] Frequently Asked Questions
http://forums.ni.com/ni/help_faq
Joe Friedchicken
NI VirtualBench Application Software
Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
Senior Software Engineer :: Multifunction Instruments Applications Group
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Solved!
Go to Solution.Hi Joe,
Thanks for all of the questions and congrats on posting your first question!
Unfortunately I think all of your questions come from the valid assumption that the search query functionality is more robust than it actually is. The search query functionality really only serves a single purpose and that is to email you when your phrase has been posted to the forums. For me, I use it to email me when my name is mentioned in the forums. It serves this purpose well since I have it set up to work off just a single search term. However I find that multiple word phrases are combined with an OR which is not as useful. The search query does not adhere to any common search syntax that you would expect (I believe we are the only community that uses this feature so it has not been improved upon).
The best way to set up both multiple word queries and multiple different queries is to use the RSS feed as you mentioned. This way you can tailor your search very specifically using different advanced search options and subscribe to them all in one feed reader without constantly getting emails. The search query emails do not adhere to the digest subscription settings. I find that the RSS feeds work very well for searches and I am fond of using them, but I do use an RSS Reader for many things so it is not out of my normal workflow.
Thank you for reading the Forum FAQ. I've done some work to improve it but I think it has a long way to go and it's good to know that people read it
Regards,
Laura
Web Support & Operations
National Instruments -
How to get max date in variable using dynamic query
Hi,
the following code gets all dates from sourcetable i want only max date , so i thought max function can be added and it will work
but still i have to create a table for one value(scalar) can get it in any other effeciant way.
declare
TYPE date_string IS TABLE OF VARCHAR(1000);
date_obj date_string;
BEGIN
EXECUTE IMMEDIATE 'SELECT to_char('''||day1||'-'||month1||'-'||year1||''') FROM '||source_schema||'.'|| sourcetable ||'' bulk collect INTO date_obj;
FOR indx IN date_obj.FIRST..date_obj.LAST loop
dbms_output.put_line(
date_obj(indx));
END loop;
DBMS_OUTPUT.PUT_LINE('Sample output');
END;
yours sincerely944768 wrote:
the following code gets all dates from sourcetableNo it doesn't. What is the datatype of day1, month1 and year1? They cannot be DATE datatypes otherwise your TO_CHAR would fail with all that concatenation going on. And your TO_CHAR is returning a VARCHAR2 datatype... so you cannot say that it is getting all dates... because there are no DATE datatypes returned. It's getting a lot of strings, but certainly not DATE's.
i want only max date , so i thought max function can be added and it will work You can use the MAX function on a DATE datatype, but not on strings (at least not in the way you intend it to work).
Converting it to a DATE before doing the MAX will allow you to get the maximum date (assuming the date format is correct)
EXECUTE IMMEDIATE 'SELECT max(to_date(to_char('''||day1||'-'||month1||'-'||year1||'''),''DD-MM-YYYY'')) FROM '||source_schema||'.'|| sourcetable ||'' bulk collect INTO date_obj;Then you will find have the other issues...
a) you are then going to be fetching your DATEs in to a collection of VARCHAR strings. (Not even VARCHAR2, very poor). This should be DATE datatype
b) you are bulk collecting into a collection, when you are using MAX which will return a single value in your example
And you really should address the design issues:
c) why are day, month and year, not being stored in the database as a single DATE datatype in the first place
d) why does your code not know the name of the table it's querying requiring the use of very poor dynamic SQL techniques.
e) why are you loading data in a collection in expensive PGA memory... what can't you do in SQL that requires you to collect the data into memory first? -
Master data time dependant attribute in query for several dates
Hello all,
I need to create a query to display prices for a material in different periods.
The user will enter a period interval. For each period, they want to know the material price the last day of that period.
Material price is a time-dependat attribute of material, and I created one formula variable to display it. The problem is the using the key-date of the query only works for a date, but not for severals.
Is there any other way to do it?
If not, the only solution I find is to have in the infoprovider the prices that I need, but I don't think this is a good practice.
Any suggestions?
Thanks!I have just seen something: in fact the created lines are:
Key1 Compound1 fromdate todate attr1 attr2
0001 L 01.01.1000 01.01.2006 <empty
so as you can see, the right interval is created but the attributes are not up to date.
Cheers.
Cyril.
Maybe you are looking for
-
Weird behavior in latest release
I've noticed a couple odd things in the latest beta release: 1) When I click on a shape that didn't previously have focus, the MouseEvent always has a click count of 2. 2) The default font size of RadioButtons appears to have been increased, but thei
-
Wrong Calculation of Sales & Administration Cost and COGS
Dear Sir, We have a scenario where we charge Over-Head on the Labour . Accordingly we have made necessary setting in the configuration . But in the Cost Run , we find that COGS / Sales & Administration Cost is getting calculated wrongly . To expl
-
The handler of the client doesn't work
the client is a java application, and I have add the handler to de handlerchain of the client's registry, but it just doesn't work. What's the matter? This is my code: String url = "http://127.0.0.1:8080/HelloWorld/HelloWorld?wsdl"; String namespace
-
Audigy, no sound after rest
I recently formatted my hard dri've. After I finished installing Windows XP, I got my Sound Blaster Audigy, DR release 2.2. driver from this website. Except whenever I restart my computer, the sound doesn't work and I have to reinstall the driver to
-
ok, heres what i want to do, i have a clip that i have 'frozen' and at the point where it freezes or pauses, i , using the motion tab, adjusted the scale of the image so that over time (3-4 seconds) there is a zoom in effect (its like what they do in