Min,max group by to split by gaps
Hi ,
i have the following data :
id start_date end_date
1 01-01-2007 31-01-2007
1 01-02-2007 28-02-2007
1 01-04-2007 31-04-2007
1 01-05-2007 31-05-2007
1 01-07-2007 31-08-2007
how can i get the following result :
id start_date end_date
1 01-01-2007 28-02-2007
1 01-04-2007 31-05-2007
1 01-07-2007 31-08-2007
thanks
SQL> SELECT num,MIN(TO_DATE(dt1,'DD-MM-RRRR')),MAX(TO_DATE(dt2,'DD-MM-RRRR')) FROM
2 (SELECT g.*,TO_CHAR(TO_DATE(dt1,'DD-MM-RRRR'),'MM') - rownum rn FROM
3 (select y.* from
4 (select 1 as num,'01-01-2007' AS dt1,'31-01-2007' as dt2 FROM Dual
5 UNION
6 select 1 as num,'01-02-2007' AS dt1,'28-02-2007' as dt2 FROM Dual
7 UNION
8 select 1 as num,'01-04-2007' AS dt1,'30-04-2007' as dt2 FROM Dual
9 UNION
10 select 1 as num,'01-05-2007' AS dt1,'31-05-2007' as dt2 FROM Dual
11 UNION
12 select 1 as num,'01-06-2007' AS dt1,'30-06-2007' as dt2 FROM Dual
13 UNION
14 select 1 as num,'01-08-2007' AS dt1,'31-08-2007' as dt2 FROM Dual
15 UNION
16 select 1 as num,'01-01-2008' AS dt1,'31-01-2008' as dt2 FROM Dual
17 UNION
18 select 1 as num,'01-02-2008' AS dt1,'28-02-2008' as dt2 FROM Dual
19 ) y ORDER BY TO_DATE(dt1,'DD-MM-RRRR')) g) h
20 GROUP by rn,num
21 /
NUM MIN(TO_DA MAX(TO_DA
1 01-JAN-07 28-FEB-07
1 01-APR-07 30-JUN-07
1 01-AUG-07 31-AUG-07
1 01-JAN-08 28-FEB-08
SQL> Message was edited by:
user605919
Similar Messages
-
Get max min per group in sequence
I have a list like this below with desired result, please help.
The X are GPS cordinates, the time is the GPS times
X time
A 5
B 6
B 7
C 8
C 9
A 10
B 11
The result must be:
X min max
A 5 5
B 6 7
C 8 9
A 10 10
B 11 11Here is a slightly diff solution, but you need SS 2012 or greater.
The idea is expressed in each CTE.
- Identify each new gps coordinate in time sequence per each car (new_gps).
- Count how many new_gps you have for each row in specific partition and windows frame (grp_helper).
- Aggregate to find min / max for each group (car, x, grp_helper).
- Bring next minTime
- APPLY to split the rows waiting and then moving
SET NOCOUNT ON;
USE tempdb;
GO
Create table #test (Car int, X Char(1), [Time] int)
INSERT INTO #test
VALUES
( 11, 'A', 5 ),
( 11, 'B', 6 ),
( 11, 'B', 7 ),
( 11, 'B', 8 ),
( 11, 'C', 9 ),
( 11, 'C', 10 ),
( 11, 'C', 11 ),
( 11, 'A', 12 ),
( 11, 'B', 13 );
-- ( 12, 'A', 15 ),
-- ( 12, 'B', 16 ),
-- ( 12, 'B', 17 ),
-- ( 12, 'B', 18 );
WITH C1 AS (
SELECT
Car,
X,
[Time],
CASE
WHEN X = LAG(X, 1, NULL) OVER(PARTITION BY Car ORDER BY [Time]) THEN 0 ELSE 1
END AS new_gps
FROM
#test
, C2 AS (
SELECT
Car,
X,
[Time],
SUM(new_gps) OVER(
PARTITION BY Car
ORDER BY [Time]
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS grp_helper
FROM
C1
Agg AS (
SELECT
Car,
X,
MIN([Time]) AS minTime,
MAX([Time]) AS maxTime,
COUNT(*) AS cnt
FROM
C2
GROUP BY
Car,
X,
grp_helper
, C3 AS (
SELECT
Car,
X,
minTime,
maxTime,
cnt,
LEAD(minTime, 1, maxTime) OVER(PARTITION BY Car ORDER BY minTime) AS nxt_minTime
FROM
Agg
SELECT
T.Car,
T.X,
T.minTime,
T.maxTime,
T.moving
FROM
C3
CROSS APPLY
SELECT C3.Car, C3.X, C3.minTime, C3.maxTime, 1 AS moving
WHERE cnt = 1
UNION ALL
SELECT C3.Car, C3.X, C3.minTime, C3.maxTime, 0 AS moving
WHERE cnt > 1
UNION ALL
SELECT C3.Car, C3.X, C3.maxTime, C3.nxt_minTime, 1 AS moving
WHERE cnt > 1
) AS T
ORDER BY
T.Car,
T.minTime;
GO
DROP TABLE #test;
GO
AMB
Some guidelines for posting questions...
AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas -
Can we use MRP to plan for FERT in-house produced with PIR's & has Min/Max
Hi SAP Guru's
I have a very critical issue from the client who wants to use MIN/ MAX stock values for planning its finished products (in-house produced)
<b>here is the details of the scenario</b>
Client recieves 2 Excel files every week from customer
<b>1st</b> file contains the Weekly Demand Forecast of FERT material for next 1 year and they upload it in MD61 as PIR's <u><b>BUT</b></u> this value is also <u><b>Inclusive</b></u> of Safety stock value (<b>ex: if weekly demand entered in MD61 as PIR is 50 and if safety stock value is 10, then actual demand is only 40)</b>
<b>2nd</b> file send contains only <b>safety stock values</b> (for ex in this case let it = <b>10</b>) to be maintained for the FERT materials
the client wants MRP to plan and trigger based on this PIR's in MD61 and Safety stock level fand plan for FERT, HALB and also ROH materials as defined in the BOM also taking into consideration the current WIP levels (Work in progress for any existing production orders currently being processed) based on the production Lead times values maintained
so what the client wants is they want to maintain 2 stock values, that is one least stock value and other higher value which if stock falls below this point, will trigger production based on the lead time and considering any WIP levels also
<b>(for ex in this case if PIR = 50 and safety stock is 10, MRP run result client wants is = 30 and NOT =40)</b>
so here are my questions
1. is this scenario feasible? use safety stock and min/max level for in-house produced finished which has demand PIRs in MD61 at the same time?
2. Also due to SOX complaince regulations, the client does not want to change the forecast values in MD61, so is it possible to make some settings so that forecast is corrected by WIThOUT including the safety stock value in it? ( for ex: in this case as = 40 only and NOt as 50)
3. which all settings should i maintain like for MRP type or lot size or stock qty levels or anyother customizations if any required so that when we run MRP, can it ignore the safety stock value and generate the client desired output?
thank u verymuch for your time & expert advice in advanceHi Chakri,
This is not possible as per standard functionality. MRP always creates proposals for the shortage quantity of the safety stock. We have used the user exit in the plant level MRP run to exclude both plant and safety stock in the net requirements calculation.
You have to write logic to convert the safety stock into plant stock in the user exit so there will be no additional procurement proposals...you can create custom indicatar in materail master or linked any existing indicator like MRP group to the user exits so the MRP will checks this and will not create proposals for the selected parts.
If you have any questions then please inform.
Regards
TAJUDDIN -
Min/Max Internal Orders 1 Requisition
We are running Min/Max planning to replenish stock in an "Emergency Warehouse" organization. The requisition import kicks off internal orders to a replenishment organization. The planner in the replenishment organization would like one order for each Min/Max run. The requisition group-by default in Purchasing parameters is vendor yet we are still seeing one unique requisition for each item thus creating one unique internal sales order per item. Thoughts?
Stick wrote:
The requisition group-by default in Purchasing parameters is vendor yet we are still seeing one unique requisition for each item thus creating one unique internal sales order per item. Thoughts?In this case the requisitions will not be grouped by Vendor because the supply source is Inventoy which is creating internal requisitions and not purchasing requisition (source is Supplier/ Vendor).
It is important to know how you are importing requisitions and what value is specified for Group By parameter during import. The value you setup in Purchasing Options defaults in the Requisition Import request parameter screen, but this can be changed before submission. So it is possible in your case that requisitions are imported using a different group by than what is specified in Purchasing Options.
From the list of different group by options available (All, Buyer, Category, Item, Supplier) you can probably use 'Location' during requisition import.
Location: Group requisition lines for each delivery location on a separate requisition.
But this will not guarantee 100% success because:
- If you import requisitions with source as INV then those can include requisitions from different INV sources generated from Reorder, Kanban etc having same delivery location. In that case all those requisitions will be grouped under a single header having same location.
- there may be different users running requisition import manually and some may forget to change this group by parameter (defaulted from purchasing options) while importing Min-Max planned requisitions (again they cannot segregate Min-Max, they can just specify INV as source)
A better solution would be to use the oracle provided custom hook (po_reqimp_pkg.post_validate_user_extensions) for requisition import to populate the GROUP_CODE column in PO_REQUISITIONS_INTERFACE table. The logic inside the hook should identify the rows in the interface table generated from each run of Min-Max and populate a unique value for all those rows in the GROUP_CODE column. You need a small piece of code to be added inside the hook.
You can also use REQ_NUMBER_SEGMENT1 column in the interface table to populate an unique value for all rows you want to group together. But in this case the value you specify will become the requisition number if there are no conflicts with the requisition number rule. Both these column, when populated, have precedence over Group by parameter. 1st priority GROUP_CODE (if populated). If GROUP_CODE is not populated then it checks REQ_NUMBER_SEGMENT1. If this is also blank then it uses Group By parameter.
Thanks
Supro -
Pivot min & max in single row.
Greetings,
Please help me in this case...
Can we get the columns as,
Dimension, # Count, MAX (# Count), MIN (#Count) all in one line with separate values but separate min, max & count in pivot.
also imagine for multiple rows .
this report is seen on year level but the min & max shld be on a level below, quarter.
i.e. this report will give the total count for all quarters, max no of count from 4 quarters & same for min.
---------|_--____________YEAR_____________
Dim ---|# Count -- MAX (Count) --- MIN (Count)
Please help.
Thanks,
DevI'm not sure if this is what you're after, but using Aketi's tabibitosan method:
with results as (select someid,
adate,
row_number() over (order by adate) rn,
dense_rank() over (partition by someid order by adate) dr,
row_number() over (order by adate) - dense_rank() over (partition by someid order by adate) diff
from t1)
select someid,
min(adate) min_adate,
max(adate) max_adate
from results
group by someid, diff
order by min(adate);
SOMEID MIN_ADATE MAX_ADATE
756 25/01/2010 07:22:57.000000 25/01/2010 07:23:58.000000
822 25/01/2010 07:24:44.000000 25/01/2010 07:25:33.000000
770 25/01/2010 07:29:53.000000 25/01/2010 07:30:11.000000
816 25/01/2010 08:03:02.000000 25/01/2010 08:27:13.000000
770 25/01/2010 08:54:04.000000 25/01/2010 08:54:16.000000
822 25/01/2010 08:58:07.000000 25/01/2010 08:58:09.000000 -
Find out the MIN & MAX of DATE QUARTERWISE
Hi All ,
I need to find out the MIN & MAX of DATE for QUARTEWISE by using SQL Only . How we can do it ? if anybody knows Please revert me .
Thanx in Advance
ByeSQL> select deptno,
2 to_char(trunc(hiredate,'q'),'YYYY"Q"Q'),
3 to_char(min(hiredate),'DD.MM') MIN,
4 to_char(max(hiredate),'DD.MM') MAX
5 from emp
6 group by deptno, trunc(hiredate,'q');
DEPTNO TO_CHA MIN MAX
10 1981Q2 09.06 09.06
10 1981Q4 17.11 17.11
10 1982Q1 23.01 23.01
20 1980Q4 17.12 17.12
20 1981Q2 02.04 02.04
20 1981Q4 03.12 03.12
20 1987Q2 19.04 23.05
30 1981Q1 20.02 22.02
30 1981Q2 01.05 01.05
30 1981Q3 08.09 28.09
30 1981Q4 03.12 03.12 -
hi all, forgot i had a user name and password and haven't needed help for quite a bit since i didn't do sql for a while but now i'm back at reporting again...
Here is a sample table as i remember it:
Item Date Time Time Frame Duration Duration Frame
A 20100926 0 5 500 10
A 20100926 600 10 500 30
A 20100926 1500 12 100 30
B 20100926 1800 28 200 40
B 20100926 2200 6 150 70
B 20100926 2600 15 600 60
B 20100926 3600 30 200 70
Results Set (expected):
Item Date Time Total Duration
A 20100926 0 1600:20 --basically max (time+duration) - min(time+duration)
B 20100926 1800 2000:00
Sorry, but. I didnt put my sql statement as I wasn't planning on posting and left it at work, but, i've been looking on internet and people say to use min/max function and i've attenpted it with it works with just this table (without grouping). But as soon as i group it the values seem to mess up.
Last i remembered it gave me:
Item Date Time Total Duration
A 20100926 0 1600:30 --basically max(time+duration) - min(time+duration)
B 20100926 1800 2000:70
I think it's looking at max duration which is 30&70 and hence it retrurns those values in the result set. Is it because of the max function hence it's returning this value? any help is appreciated. thanks
Edited by: stanleyho on Sep 30, 2010 4:44 PMOkay, here we go again, repost, hopefully okay this time:
Hi Madhu, okay, just got to work: I am using TOAD and working in Oracle 10g. Here is my table structure and the query i use to try and get what I am looking for:
There is one extra table but that is only used to link these two tables listed below so i didn't bother posting it.
TABLE: TX_RECON_INSTANCE_VIEW
ColumnName ColID DataType Null
CHANNEL_CODE 3 VARCHAR2 (4 Char) N
DURATION 8 NUMBER (10) N
DURATION_FRAME 9 NUMBER (2) N
REAL_TIME 6 NUMBER (10) N
REAL_TIME_FRAME 7 NUMBER (2) N
ITEM_ID 4 NUMBER Y
TX_DATE 2 CHAR (8 Byte) N
TX_ID 1 NUMBER (9) N
TX_TYPE 13 VARCHAR2 (4 Char) N
TABLE: TX_SCHEDULE
ColumnName ColID PK Null DataType
TX_TYPE 22 N VARCHAR2 (4 Char)
TX_ID 1 1 N NUMBER (9)
TX_DATE 2 N CHAR (8 Byte)
SCHEDULE_TIME_FRAME 9 N NUMBER (2)
SCHEDULE_TIME 8 N NUMBER (10)
REAL_TIME 10 N NUMBER (10)
DURATION_FRAME 13 N NUMBER (2)
DURATION 12 N NUMBER (10)________________________________________
And the data and results:
TX_ID TX_DATE REAL_TIME REAL_TIME_FRAME DURATION DURATION_FRAME ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION SCHEDULE_TIME SCHEDULE_TIME_FRAME DURATION_1 DURATION_FRAME_1
1651000 20100710 0 0 545 20 1234 00:00:00:00 00:09:05:20 00:00:00:00 00:09:05:20 0 0 545 20
1752223 20100710 667 12 281 7 1234 00:11:07:12 00:04:41:07 00:11:07:10 00:04:41:07 667 10 281 7
1846501 20100710 1071 13 335 9 1234 00:17:51:13 00:05:35:09 00:17:50:09 00:05:35:09 1070 9 335 9
2001102 20100710 1525 6 249 14 1234 00:25:25:06 00:04:09:14 00:25:22:08 00:04:09:14 1522 8 249 14
3246669 20100710 1800 0 586 2 1235 00:30:00:00 00:09:46:02 00:30:00:00 00:09:46:02 1800 0 586 2
4456822 20100710 2492 16 276 5 1235 00:41:32:16 00:04:36:05 00:41:32:16 00:04:36:05 2492 16 276 5
1253168 20100710 2890 15 222 17 1235 00:48:10:15 00:03:42:17 00:48:10:15 00:03:42:17 2890 15 222 17
1112456 20100710 3277 18 297 0 1235 00:54:37:18 00:04:57:00 00:54:35:10 00:04:57:00 3275 10 297 0
Grouped results set:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:20
20100710 1235 00:30:00:00 00:29:34:17 00:30:00:00 00:29:32:17
--> SCHEDULED DURATION "00:29:31:20" is not correct as it should be (00:25:22:08+00:04:09:14)-(00:00:00:00)=00:29:31:22
--> see expected results below
Expected results:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:22
20100710 1235 00:30:00:00 00:29:34:18 00:30:00:00 00:29:34:10________________________________________
And the query I am using:
SELECT --TXR.TX_ID,
TXR.TX_DATE, TXR.ITEM_ID,
TO_CHAR(TRUNC((MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "AS RUN TIME",
to_char(trunc((MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME_FRAME+TXR.DURATION_FRAME)-MIN(TXR.REAL_TIME),60),'FM00') "AS RUN DURATION",
TO_CHAR(TRUNC((MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "SCHEDULED TIME",
to_char(trunc((MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),60),'FM00')||':'||to_char(mod(MAX(TXS.DURATION_FRAME),60),'FM00') "SCHEDULED DURATION"
FROM TX_RECON_INSTANCE_VIEW TXR, TX_SCHEDULE TXS, TX_SCHEDULE_RECON TXREC
WHERE TXR.TX_DATE=20100926 AND TXR.TX_TYPE='P'
AND TXR.TX_ID=TXREC.RECON_TX_ID(+)
AND TXREC.BASE_TX_ID=TXS.TX_ID(+)
GROUP BY TXR.TX_DATE, TXR.ITEM_ID
ORDER BY TXR.TX_DATE, TXR.ITEM_ID, MAX(TXR.REAL_TIME)--does this work for everyone now? let me know...thanks -
Hello
DC521 activity check the mix and max limit of the DC parameteer already collected, if I already NOT checked the ‘Override Min/Max’ then this check will be done at before saving the DC record.
So DC521 works when I allow to override the min and max value while collecting data by checking that check box and do the check later in the process through DC521, please suggest ?
Another question same area
In DC parameter details screen -
Difference between ‘Override Min/Max’ and ‘Soft Limit Check on Min/Max Value’?
ThanksHi!
Technically there is no difference between Override Min/Max and Soft Limit Check now. Originally the latter was meant for QM groups received from ERP, but eventually this restriction was not implemented. Override Min/Max as ME original feature not related to ERP integration was meant for usage along with Certification check.
Regards,
Sergiy -
Want to set Min Max for a material for PD MRP type
Hi,
I know Maximum stock level field in Material master MRP 2 view ? but where do i maintain minimum stock level? not procured?
My client wants to set up his inventory with Min Max levels using MRP PD?
Thanks and Apprecaites help.
Regards,
SivaHi,
If you want to maintain a Max and Min stock level, Maximum stock is shown straight away, you cannot find the Minimum field directly.
if you want to use MRP type PD then go for safety stock that will be your minimum stock level
or else use Re-order point planning, re-order point will be your minimum and Max-level as maximum.
Thanks
Satya -
How to Get the min,max and original values in a single query
Hi,
I have a task where in i have to the min , max and the original values of a data set .
I have the data like below and i want the target as well as mentioned below
SOURCE
DATASOURCE
INTEGRATIONID
SLOT_DATE
SLOT1
SLOT2
SLOT3
SLOT4
SLOT5
SLOT6
SLOT7
SLOT8
SLOT9
SLOT10
1
101
201111
100
100
200
100
100
100
300
300
300
300
1
101
2011112
200
200
200
200
100
100
100
100
200
300
TARGET
DATASOURCE
INTEGRATIONID
SLOT_DATE
SLOT_VALUE
SLOT MIN
SLOT_MAX
SLOT NUMBER
1
101
201111
100
1
2
SLOT1
1
101
201111
100
1
2
SLOT2
1
101
201111
200
3
3
SLOT3
1
101
201111
100
4
6
SLOT4
1
101
201111
100
4
6
SLOT5
1
101
201111
100
4
6
SLOT6
1
101
201111
300
7
10
SLOT7
1
101
201111
300
7
10
SLOT8
1
101
201111
300
7
10
SLOT9
1
101
201111
300
7
10
SLOT10
1
101
2011112
200
1
4
SLOT1
1
101
2011112
200
1
4
SLOT2
1
101
2011112
200
1
4
SLOT3
1
101
2011112
200
1
4
SLOT4
1
101
2011112
100
5
8
SLOT5
1
101
2011112
100
5
8
SLOT6
1
101
2011112
100
5
8
SLOT7
1
101
2011112
100
5
8
SLOT8
1
101
2011112
200
9
9
SLOT9
1
101
2011112
300
10
10
SLOT10
e
so basically i would first denormalize the data using the pivot column and then use min and max to get the slot_start and slot_end.
But then i
can get the min and max ... but not the orignal values as well.
Any thoughts would be appreciated.
ThanksIf you want to end up with one row per slot per datasource etc, and you want the min and max slots that have the same value as the current slot, then you probably need to be using analytic functions, like:
with t as
(SELECT 1 datasource,101 INTEGRATIONID, 201111 slotdate, 100 SLOT1, 100 SLOT2, 200 slot3, 100 slot4, 100 slot5, 100 slot6, 300 slot7, 300 slot8, 300 slot9, 300 slot10 FROM DUAL union all
SELECT 1, 101, 2011112, 200, 200, 200, 200, 100, 100, 100, 100, 200, 300 FROM DUAL),
UNPIVOTED AS
(SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,1 SLOT,SLOT1 SLOT_VALUE
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,2 SLOT,SLOT2
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,3 SLOT,SLOT3
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,4 SLOT,SLOT4
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,5 SLOT,SLOT5
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,6 SLOT,SLOT6
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,7 SLOT,SLOT7
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,8 SLOT,SLOT8
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,9 SLOT,SLOT9
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,10 SLOT,SLOT10
FROM T)
select DATASOURCE,INTEGRATIONID,SLOTDATE,slot,slot_value,min(slot) OVER (partition by datasource,integrationid,slotdate,rn) minslot,
max(slot) OVER (partition by datasource,integrationid,slotdate,rn) maxslot
FROM
select DATASOURCE,INTEGRATIONID,SLOTDATE,max(rn) over (partition by datasource,integrationid,slotdate order by slot) rn,slot,slot_value
FROM
(SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,slot,slot_value,
case when row_number() over (partition by datasource,integrationid,slotdate order by slot) = 1 or
lag(slot_value) over (partition by datasource,integrationid,slotdate order by slot) <> slot_value
then row_number() over (partition by datasource,integrationid,slotdate order by slot)
ELSE null
END rn
from unpivoted
order by DATASOURCE,INTEGRATIONID,SLOTDATE,slot -
Can I set the min/max for multiple images at once?
I have brought in my page design from photoshop and I don't want any of the images or text to resize when the web browser window is made smaller.
Is there a way to do this without setting each min & max individually?I answered my own question in the end, I moved them to the parent background
-
Min/ Max interval data storage
OK, so what I am trying to do is scan 2 voltages at 3K, temporarily write that data to a file or buffer, read the min and max values, and log those to a file once per minute. I'm at the point where I can scan and display the data, but really don't know where to go next. Any thoughts or ideas would be much appreciated. Thanks
Attachments:
NI-6343-2CH VDC min-max.vi 45 KBYou only need a single loop. You can use the "elapsed time" express VI to signal when time has elapsed, and simply use a case structure to append the averages to the data before writing (in the false case just wire the current data across). You should also open the file before the loop, append inside the loop, and only close the file once the loop completes. You can use the min&max ptbypt VI to keep track of the min and max for each interval or just keep track of it using a shift register.
LabVIEW Champion . Do more with less code and in less time . -
DateTimeAxis min/max bug? Problems with consistent padding. Date Wrapping.
I have been working on a problem with a BarChart object that I've created using dynamic data.
My primary issue is that I can't seem to get the proper min/max values to set for the chart.
To solve this I manually found the min and max of the data set of Dates and set the min and max of the chart. This allowed me to finally see all the floating custom bars (each bar is rendered with a user set fill), however now if I have a bar that extends over a year change the horizontal axis labels do not wrap the date properly, so instead of 2/10 (feb 2010) being the last date, 12/09 (dec 2009) is the last date.
I've been trying to dynamically adjust the padding based upon a change event, but so far to no avail. Partially I think because I'm not sure which event for the function to fire on.
private function dateAxisGen(r:Array):void {
var min:Number = r[0].startTime.time;
var max:Number = r[0].endTime.time;
const PAD:Number = 2;
const MILLISEC_IN_MONTH:Number = 2629743830;
const MILLISEC_IN_WEEK:Number = 604800000;
const MILLISEC_IN_DAY:Number = 864;
for (var i:int = 1; i < r.length; i++) {
var o:OperationXT = OperationXT(r[i]);
min = Math.min(o.startTime.time, min);
max = Math.max(o.endTime.time, max);
// Calculates the maximum range, then adds an appropriate
// padding to the chart via extra time. TODO
/* var range:Number = max - min;
if(range >= MILLISEC_IN_MONTH) {
dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
} else if(range >= MILLISEC_IN_WEEK) {
dAxis.padding = (MILLISEC_IN_DAY)/PAD;
dAxis.padding = (MILLISEC_IN_DAY)/PAD;
} else {
dAxis.padding = PAD;
dAxis.minimum = new Date(min);
dAxis.maximum = new Date(max);
this, however, does not adjust the padding properly when an operation is removed from the list. Not to mention I still have the date wrapping error. It gives me the following error:
Cannot access a property or method of a null object reference.
at mx.charts::AxisRenderer/measureHorizontalGutters()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\AxisRenderer.as:2244]
at mx.charts::AxisRenderer/calcRotationAndSpacing()[C:\work\flex\dmv_automation\projects\dat avisualisation\src\mx\charts\AxisRenderer.as:1858]
at mx.charts::AxisRenderer/adjustGutters()[C:\work\flex\dmv_automation\projects\datavisualis ation\src\mx\charts\AxisRenderer.as:1534]
at mx.charts.chartClasses::CartesianChart/updateAxisLayout()[C:\work\flex\dmv_automation\pro jects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:2239]
at mx.charts.chartClasses::CartesianChart/updateDisplayList()[C:\work\flex\dmv_automation\pr ojects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:1366]
at mx.core::UIComponent/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8065]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:663]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:736]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\managers\LayoutManager.as:1069]
Any help with my problem would be greatly appreciated.
ADDITIONAL INFO:
Alright, so I've discovered that the ONLY time the date wrapping error occurs is when the axis labels contain only the month and year, any other time it places it properly.
Does anyone know where I can report this bug?Perre wrote:I'm used to being able to pick one or a couple of songs and then adding it a specified playlist. Is this impossible in sonata?
It's clearly not impossible, just different than you expect. Create your playlist as you want it to appear in the Current tab (meaning don't dump every single song from your library in there, just the ones you want) and then save the playlist.
Perre wrote:And if I try to play the m3u file created (the one with every song listed) through freevo I get a message that the directory is empty. What am I doing wrong??
Look at save_absolute_paths_in_playlists in your mpd.conf. -
I have a Power Mac G5 - How can I run Matrox MX02 mini max
I have a Power Mac G5 Running Mac OSX 10.5.8 I recently got the MX02 Mini Max by Matrox to run my Final Cut Studio application version 6.6 and Im having problems with the pci board that comes with the matrox unit ( it does not fit in the mother board) how would i be able to use this with out connecting the pci board into my mother board on my Mac.?
Can't use it with a G5.
System requirements are Mac Pro and Intel-based MacBook Pro running Mac OS X Leopard 10.5.6 or higher.
IF (big if) the card is PPC Mac compatible, only Late 2005 G5 machines have PCIe. All other G5s are PCI.
The Matrox card is PCIe, not PCI. -
Vendor details for a Min Max requisitions
Hi All
When Min Max trigger some requisition interface lines, we need to get the vendor details also be populated,
What set up it need to get these. Because when I run a Min-Max planning report, I am not getting the vendor details.
What we have is we will be having a single item be with a single vendor and vendor site
Please help.In the General planning tab for Sourcing type is it mentioned as Supplier?
Is the use ASL flag in the Purchasing tab for the item enabled?
The supplier and site details are active?
The ASL for this item is still active ? (Check in the supplier line details in the ASL form)
My funtional guy says yes to all the above quries.
And also says All ASL have the sourcing rules assigned to the assignment set that is setup on the MRP: Default Sourcing Assignment Set profile, but this scenario is only for minmax
So this issues is only for MIN-MAX.Please let me know if any thing to be done in setup to automatically get the
vendor details into requistions lines of interface table based on items.
Edited by: 834095 on Mar 14, 2011 2:59 AM
Maybe you are looking for
-
EA4500 problem with https access
I am not able to access https sites (like banking etc.). Once I plug my old router back I have no such problem. I guess it must be router settings that I cannot figure out. Any help will be appreciated. Jan
-
Hi, I have a basic question regarding PM order settlement. I know that for PP orders, following are the settlement steps for individual processing. 1) After final confirmation of the order (status CNF) using IW41, do GR (IW8W for refurbishment order,
-
Grant access to specfic schema
Is there any way that these permissions could be created without the ANY clause? CREATE ANY CONTEXT DROP ANY CONTEXT EXECUTE ANY PROCEDURE EXECUTE ANY TYPE I got access to only one schema ..Client side DBA are not permitting access to "ANY" clause bu
-
On random occasions when I type some key words in the search bar and then hit enter I can see the results for a brief moment and then they disappear. I then have to click Search again for them to reappear. This happens in Google. Not sure if this is
-
My app store is not connected to my itunes account, but an old friends. she changed her password and im no longer able to get apps. my ipod is connected to my itunes account, but not app store. how do i get the app store to sync with my itunes accoun