Select just the values between min and max of an accumulated value over day
Hello Forum,
a value is accumulated over a day and over a period of time. Next day the value is reseted and starts again to be accumulated:
with sampledata as (select to_date('09.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 23 val from dual union all
select to_date('09.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 29 val from dual union all
select to_date('09.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 30 val from dual union all
select to_date('09.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 45 val from dual union all
select to_date('09.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 60 val from dual union all
select to_date('09.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 75 val from dual union all
select to_date('09.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 95 val from dual union all
select to_date('09.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 17:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 23:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 14 val from dual union all
select to_date('10.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 34 val from dual union all
select to_date('10.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 58 val from dual union all
select to_date('10.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 70 val from dual union all
select to_date('10.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('10.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual)
select ts, val
from sampledata
order by ts asc;How should I change the select statement to skip all data sets before the first minimum and the duplicates after the maximum of a day in order to get such a result:
TS VAL
09.09.12 06:12 23
09.09.12 07:12 29
09.09.12 08:12 30
09.09.12 09:12 45
09.09.12 10:12 60
09.09.12 11:12 75
09.09.12 12:21 95
09.09.12 13:21 120
09.09.12 14:21 142
10.09.12 06:12 14
10.09.12 07:12 34
10.09.12 08:12 58
10.09.12 09:12 70
10.09.12 10:12 120
10.09.12 11:12 142
10.09.12 12:21 153Thank you
This solution works perfectly when the accumulated value has its low and its high on the same day. But I found out :( , that there is also data, which has its low yesterday and its high today. For a better understandig of the case, there is a machine, wich is working over 3 Shifts with irregular start and end time. For example Shift1 cann start at 5:50 or at 7:15. The accumulated value of the worked time is accumuated for each shift extra. This solution works for the shift 1 (approximate between 06:00-14:00) and for the shift 2(approximate between 14:00-22:00), because there is the low and the high of the accumulated value on the same day. This solution does not work for the shif 3(approximate between 22:00-06:00), because the high of the accumulated value is or can be the next day.
So the thread title should be: "Select just the values between min and max of an accumulated value over the same day(today) or over two successive days (yesterday and today)
Sampledata for shift 1 or shift 2:
{code}
with sampledata as (select to_date('09.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 23 val from dual union all
select to_date('09.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 29 val from dual union all
select to_date('09.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 30 val from dual union all
select to_date('09.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 45 val from dual union all
select to_date('09.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 60 val from dual union all
select to_date('09.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 75 val from dual union all
select to_date('09.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 95 val from dual union all
select to_date('09.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
select to_date('09.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 17:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('09.09.2012 23:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 143 val from dual union all
select to_date('10.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 144 val from dual union all
select to_date('10.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 145 val from dual union all
select to_date('10.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 147 val from dual union all
select to_date('10.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 148 val from dual union all
select to_date('10.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
select to_date('10.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual)
, got_analytics AS
SELECT ts, val
, MIN (val) OVER ( PARTITION BY TRUNC (ts)
ORDER BY ts DESC
) AS min_val_after
, CASE
WHEN ROW_NUMBER () OVER ( PARTITION BY TRUNC (ts)
ORDER BY val
, ts
) = 1
THEN -1 -- Impossibly low val
ELSE LAG (val) OVER ( PARTITION BY TRUNC (ts)
ORDER BY ts
END AS prev_val
, MIN (val) OVER (PARTITION BY TRUNC (ts))
AS low_val_today
, NVL ( LAST_VALUE (val) OVER ( ORDER BY ts
RANGE BETWEEN UNBOUNDED PRECEDING
AND ts - TRUNC (ts) PRECEDING
, -1
) AS last_val_yesterday
FROM sampledata
SELECT ts
, val
FROM got_analytics
WHERE val <= min_val_after
AND val > prev_val
AND ( val > low_val_today
OR val != last_val_yesterday
ORDER BY ts
{code}
with the expected results:
{code}
1 09.09.2012 06:12:02 23
2 09.09.2012 07:12:03 29
3 09.09.2012 08:12:04 30
4 09.09.2012 09:12:11 45
5 09.09.2012 10:12:12 60
6 09.09.2012 11:12:13 75
7 09.09.2012 12:21:24 95
8 09.09.2012 13:21:26 120
9 09.09.2012 14:21:27 142
10 10.09.2012 06:12:02 143
11 10.09.2012 07:12:03 144
12 10.09.2012 08:12:04 145
13 10.09.2012 09:12:11 146
14 10.09.2012 10:12:12 147
15 10.09.2012 11:12:13 148
16 10.09.2012 12:21:24 153
{code}
And the sampledata for shift 3 is:
{code}
with sampledata as (select to_date('08.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 23 val from dual union ALL
select to_date('08.09.2012 02:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 45 val from dual union all
select to_date('08.09.2012 05:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 78 val from dual union all
select to_date('08.09.2012 06:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 08:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 10:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 12:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 16:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 17:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 19:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 21:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 90 val from dual union all
select to_date('08.09.2012 22:00:12', 'dd.mm.yyyy hh24:mi:ss') ts, 24 val from dual union all
select to_date('08.09.2012 22:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 40 val from dual union all
select to_date('08.09.2012 23:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 68 val from dual union all
select to_date('09.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 79 val from dual union all
select to_date('09.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 124 val from dual union all
select to_date('09.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 125 val from dual union all
select to_date('09.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 126 val from dual union all
select to_date('09.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 17:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union all
select to_date('09.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 127 val from dual union ALL
select to_date('09.09.2012 22:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 5 val from dual union ALL
select to_date('09.09.2012 22:51:33', 'dd.mm.yyyy hh24:mi:ss') ts, 23 val from dual union all
select to_date('09.09.2012 23:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 40 val from dual union all
select to_date('10.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 50 val from dual union all
select to_date('10.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 60 val from dual union all
select to_date('10.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 78 val from dual union all
select to_date('10.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
select to_date('10.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 145 val from dual union all
select to_date('10.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual union all
select to_date('10.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 146 val from dual)
, got_analytics AS
SELECT ts, val
, MIN (val) OVER ( PARTITION BY TRUNC (ts)
ORDER BY ts DESC
) AS min_val_after
, CASE
WHEN ROW_NUMBER () OVER ( PARTITION BY TRUNC (ts)
ORDER BY val
, ts
) = 1
THEN -1 -- Impossibly low val
ELSE LAG (val) OVER ( PARTITION BY TRUNC (ts)
ORDER BY ts
END AS prev_val
, MIN (val) OVER (PARTITION BY TRUNC (ts))
AS low_val_today
, NVL ( LAST_VALUE (val) OVER ( ORDER BY ts
RANGE BETWEEN UNBOUNDED PRECEDING
AND ts - TRUNC (ts) PRECEDING
, -1
) AS last_val_yesterday
FROM sampledata
SELECT ts
, val
FROM got_analytics
WHERE val <= min_val_after
AND val > prev_val
AND ( val > low_val_today
OR val != last_val_yesterday
ORDER BY ts
{code}
with the unexpected results:
{code}
- ts val
1 08.09.2012 00:04:08 23
2 08.09.2012 22:12:13 40
3 08.09.2012 23:21:24 68
4 09.09.2012 22:21:33 5
5 09.09.2012 22:51:33 23
6 09.09.2012 23:21:33 40
7 10.09.2012 00:04:08 50
8 10.09.2012 01:03:08 60
9 10.09.2012 02:54:11 78
10 10.09.2012 03:04:08 142
11 10.09.2012 04:04:19 145
12 10.09.2012 05:04:20 146
{code}
The result should be:
{code}
- ts val
1 08.09.2012 00:04:08 23
2 08.09.2012 02:04:08 45
3 08.09.2012 05:03:08 78
4 08.09.2012 06:54:11 90
5 08.09.2012 22:00:12 24
6 08.09.2012 22:12:13 40
7 08.09.2012 23:21:24 68
8 09.09.2012 01:03:08 79
9 09.09.2012 02:54:11 124
10 09.09.2012 03:04:08 125
11 09.09.2012 04:04:19 126
12 09.09.2012 05:04:20 127
13 09.09.2012 22:21:33 5
14 09.09.2012 22:51:33 23
15 09.09.2012 23:21:33 40
16 10.09.2012 00:04:08 50
17 10.09.2012 01:03:08 60
18 10.09.2012 02:54:11 78
19 10.09.2012 03:04:08 142
20 10.09.2012 04:04:19 145
21 10.09.2012 05:04:20 146
{code}
Thank you for your help!
Similar Messages
-
Re: ERROR -- 9 [Motor unable to stabilize between min and max limits] -- (2708) TEST FAILED
Please Somebody Tell me What Is The Issue.It might be helpful if indicated exactly what you were doing when the error appeared.
-
Transactions between Min and Max dates
Hey all,
I have a requirement to extract data between min(transdate) and max(transdate), i got to do this using a single query, i used two queries, ie. 1 select for selecting the max and min dates and my second query to get the transactions. Can some one give me an idea to solve this, as Max & Min functions are not allowed in the where clause.
Thanks in Advance
- EricWhy single fetch if you want effeciency then use analytic function
SQL> SELECT empno,ename,hiredate FROM
2 (SELECT empno,ename,hiredate,MAX(hiredate) OVER (ORDER BY empno) m,
3 MIN(hiredate) OVER (ORDER BY empno) mi FROM emp)
4 WHERE hiredate BETWEEN mi AND m;The least and greatest function returns the smallest and greatest value in a list of expressions.
The syntax for the least function is:
least( expr1, expr2, ... )
Khurram -
On the fence between mini and imac
Lightning hit my g5 mac a coulple of weeks ago and I am looking to purchase another. I don't really like the new mac with the glossy display. So I thought why not just purchase a 20in or 23in apple monitor with a Mini....I know it's a little more exspensive but I like the thought of it. Any help or suggestion on the two different options?
I think the generally best advice is to buy the best system you can afford within your budget and which meets the needs you have, or perceive yourself to have. Anything less and the result will be more likely to be a system that in 2 or 3 years proves insufficient and is more likely to need replacement. Buying a system at the top end of the budget means better flexibility, more likely to meet your needs as those change and perhaps expand, and which due to better performance is also more likely to encourage further use.
The Mac mini is an excellent system in its own right of course. For the money you get a tiny computer which actually outperforms its form factor by a surprising degree. The new models are rather faster and have more 'grunt' than the top of the range G5s of barely a couple of years ago and which were billed as genuine workhorses (which they were), but it does suffer from a couple of minor shortcomings which could figure greatly in the longer term: it has a slower (laptop) drive, and integrated graphics. Neither are crippling issues unless you need very fast storage (large Photoshop files for example) or highly demanding video uses, but they have to be considered. The upside is that the mini is very expandable in terms of the things you can hang on it, such as faster hard drives, and you get the choice of display (but only one display). The iMac's shortcoming is the all-in-one design, but if the screen looks good, the imac is very hard to beat. -
PanelBox Stretch between min and max height
Hello,
I am using JDeveloper 11.1.1.6 and my client requests in the application that I am currently developing a PanelBox that stretches its height according to the content inside it. There is a minimum height (which can be greater than the height of the content) and a maximum height (which, if is exceeded by the content, should display a scroll bar).
If you have any suggestions on how I could achieve this (including modifying the CSS file) please let me know.
Best regards,
TomaHi,
have a look at the "type" property if this helps
af:panelBox tag documentation
Frank -
Min and MAx Value in a SELECT Statement
Hi,
I have a scenario where I am Selecting the values BETWEEN MIN and MAX values:
SELECT * FROM ABC WHERE CODE BETWEEN MIN(CODE) AND MAX(CODE)
ITS GETTING Error as:ORA-00934: group function is not allowed here
Any help will be needful for me.select substr(no,1,3)||to_char(substr(no,4,1)+1) "first missing number"
from
with t as
(select 'ABC1' no from dual
union select 'ABC2' from dual
union select 'ABC3' from dual
union select 'ABC5' from dual
union select 'ABC6' from dual
union select 'ABC8' from dual
select no, lead(no,1,0) over (order by no) next_no from t
where substr(next_no,4,1) - substr(no,4,1) > 1
and rownum = 1; -
Difference of value of a dimension based on min and max
Database: Oracle 10g
BO-BOXIr3
Let me explain the exact problem again.
As per the below code, I have the data in this format in my table:
Code:
Date Site ID KWH
1/2/2009 00:00 IN-1 22
1/2/2009 01:00 IN-1 28
1/3/2009 03:00 IN-2 25
1/3/2009 04:00 IN-2 46
1/4/2009 00:00 IN-3 28
1/4/2009 10:00 IN-3 34
1/5/2009 08:00 IN-4 31
1/5/2009 09:00 IN-4 55
1/5/2009 11:00 IN-4 77
1/6/2009 00:00 IN-5 34
Now want to build a report with following columns:
Site Count KWH
IN-1 2 6 (ex.-28-22)
IN-2 2 21
IN-3 2 6
IN-4 3 46 (ex.-77-31)
IN-5 2 34
SITE- distinct site name.
COUNT-count is number of repetitions of site id between min and max date.
KWH -(Delta between the min and max date)
To get the above result I have created 3 report from different queries since not able to get these al in a single report viz Count, Max Value and Min value. Well I have all these 3 reports or table on a single page.
Count-this report will give the count between the dates
Max Value-this report will give me the values of kwh for max dates for each site id
Min Value-this report will give me the values of kwh for min dates for each site id
Now want to create a single report based on these 3 reports which contains the column
Site|Count|KWH
IS IT POSSIBLE?
Or
Is it possible to build such report in a single one with all the required column which I mentioned?
The variables which I created to get the max & min dates,
Mx_dt= =Max([Query 2].[Hourly]) In ([Query 2].[SITE_ID])
Mn_dt= =Min([Query 3 (12)].[Hourly]) In ([Query 3 (12)].[SITE_ID])
For filtering on report used following variables:
if_st_mn=If([mn_dt])=[Hourly] Then "ok" Else "no"
if_st_mx =If([mx_dt])=[Hourly] Then "ok" Else "no"
will filter on "ok" to get the max and min date values.
rest of the variable in the snap are not usable.Yes, you can do it in one report.
I created a sample report from efashion:
Year | Lines | Sales Revenue
2001 | Accessories | $250
2003 | Accessories | $550
2001 | City Skirts | $1050
2003 | City Skirts | $1150...........
Create 2 variables 1) Count and 2) Difference:
1) Count as formula - =Count([Lines]) In Report
2) Difference as formula - =Sum([Sales revenue]) Where (Max([Year]) In Report = [Year]) - Sum([Sales revenue]) Where (Min([Year]) In Report = [Year])
You can replace the formula with your report variables. Then just drag Site ID, Count and Difference variables to your report.
Thanks
Jai -
Query about min and max and middle row of a table
suppose i have table emp and field
v_date date;
which has data in time stamp
time
10:20
10:25
10:30
10:32
10:33
10:35
10:36
10:38
I need only min time and max time and two record between min and maxI need only min time and max time and two record between min and max Like this?
SQL> create table t (id number);
Table created.
SQL>
SQL> insert into t values (1020);
1 row created.
SQL> insert into t values (1025);
1 row created.
SQL> insert into t values (1030);
1 row created.
SQL> insert into t values (1032);
1 row created.
SQL> insert into t values (1033);
1 row created.
SQL> insert into t values (1035);
1 row created.
SQL> insert into t values (1036);
1 row created.
SQL> insert into t values (1038);
1 row created.
SQL>
SQL> commit;
Commit complete.
SQL>
SQL> select * from t;
ID
1020
1025
1030
1032
1033
1035
1036
1038
8 rows selected.
SQL>
SQL>
SQL> select decode(rownum, 1, min_val, 4, max_val, next_val) your_data from (
2 select first_value (id) over (partition by 'a' order by 'a') min_val,
3 last_value (id) over (partition by 'a' order by 'a') max_val,
4 id,
5 lead(id) over (partition by 'a' order by id) next_val
6 from t
7 order by id
8 )
9 where min_val <> next_val and max_val <> next_val
10 and rownum <= 4;
YOUR_DATA
1020
1030
1032
1038
SQL> -
I have bought an iPhone 4S in Brazil and I would like to know if I can replace my old iPhone for a new one (iPhone 5S), at some Apple Store in USA, if I pay just the difference between both values.
You're welcome.
I would advise against that for the reasons I provided.
Could I have my iPad 2 for the new one paying the difference between their values?
No. Sell the existing yourself and use the proceeds to purchase a new iPad. -
To find out the min and max memory been used by each parameter under SGA_MA
Hi,
Can any please tell me how to find out the min and max memory been used by each parameter under SGA_MAX and SGA_TARGET ? below is the db CRMS65T. If any such script is there please provide me
SQL> select name from v$database;
NAME
CRMS65T
SQL> show parameter sga
NAME TYPE VALUE
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1000M
sga_target big integer 1000MThanks in advanceCan any please tell me how to find out the min and max memory been used by each parameter under SGA_MAX and SGA_TARGET ? below is the db CRMS65T. If any such script is there please provide meI guess your question is, each memory components of SGA? if so
SQL> select * from v$sgainfo;
NAME BYTES RES
Fixed SGA Size 2088504 No
Redo Buffers 18882560 No
Buffer Cache Size 616562688 Yes
Shared Pool Size 301989888 Yes
Large Pool Size 4194304 Yes
Java Pool Size 4194304 Yes
Streams Pool Size 0 Yes
Granule Size 4194304 No
Maximum SGA Size 947912704 No
Startup overhead in Shared Pool 125829120 No
Free SGA Memory Available 0Also check
SQL> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE,USER_SPECIFIED_SIZE from v$sga_dynamic_components;
shared pool 301989888 301989888 0 209715200
large pool 4194304 4194304 0 4194304
java pool 4194304 4194304 0 4194304
streams pool 0 0 0 0
DEFAULT buffer cache 616562688 616562688 0 603979776
KEEP buffer cache 0 0 0 0
RECYCLE buffer cache 0 0 0 0
DEFAULT 2K buffer cache 0 0 0 0
DEFAULT 4K buffer cache 0 0 0 0
DEFAULT 8K buffer cache 0 0 0 0
DEFAULT 16K buffer cache 0 0 0 0
DEFAULT 32K buffer cache 0 0 0 0
ASM Buffer Cache 0 0 0 603979776
13 rows selected.
SQL>Edited by: CKPT on Sep 19, 2011 8:55 AM -
Min and Max values from entire table
Hi,
i have requirement in which i need to find the min and max values from the entire table.
See the sample data
create table test
Sal1 int,
Sal2 int,
Sal3 int
insert into test values (100,700,5700)
insert into test values (200,3300,5300)
insert into test values (4400,1200,3500)
insert into test values (5400,5600,3100)
i want the output as 100 and 5700.. how can i achieve this in a single query. Please through some light on this topic..!
Thanking you in advance
Regards,
Balaji Prasad B
Balaji - BI DeveloperBelow is an example with a subquery for each of the queries Mohammad posted in order to return both min and max in a single result set.
SELECT ( SELECT MAX(Maxx) AS Maxx
FROM test UNPIVOT
( Maxx FOR E IN ( Sal1, Sal2, Sal3 ) ) AS unpvt
) AS Maxx
, ( SELECT MIN(Minn) Minn
FROM test UNPIVOT
( Minn FOR E IN ( Sal1, Sal2, Sal3 ) ) AS unpvt
) AS Minxx;
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
Medium, min, and max values on ALV
Hi friends ! How are are you ? Fine ?
How can i calc medium, min, and max values on ALV ?
Thanks !Hi Fabrício
I think you set fieldcatalog at runtime dynamically to arrange dynamic columns. So, while you are setting it just set proper values to the attribute "do_sum" for relevant fields.
For more information how to set fieldcatalog dynamically, you can refer to the tutorial "An Easy Reference for ALV Grid Control".
Regards
*--Serdar [[ BC ] | https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk sag jiw=] -
I have just bought an iPad mini and would like to transfer photos from my iPhone to the iPad how do I do this please?
How to Transfer Photos from an iPad to a Computer
http://www.wikihow.com/Transfer-Photos-from-an-iPad-to-a-Computer
Importing Personal Photos and videos from your iOS device to your computer.
http://support.apple.com/kb/HT4083
Copy Photos (& Videos) Between iOS Devices
http://tinyurl.com/cnz95bc
FYI
Complete guide to using iOS 6
http://howto.cnet.com/ios-6-complete-guide/
Guide to Built-In Apps on iOS
https://sites.google.com/site/appleclubfhs/support/advice-and-articles/guide-to- built-in-apps-ios
You can download a complete iOS 5 iPad User Guide and iOS 6 iPad User Guide here: http://support.apple.com/manuals/ipad/
Also, Good Instructions http://www.tcgeeks.com/how-to-use-ipad-2/
Apple - iPad - Guided Tours
http://www.apple.com/ipad/videos/
Apple iPad Guided Tours - Watch the videos see all the amazing iPad apps in action. Learn how to use FaceTime, Mail, Safari, Videos, Maps, iBooks, App Store, and more.
http://www.youtube.com/watch?v=YT2bD0-OqBM
http://www.youtube.com/watch?v=ROY4tLyNlsg&feature=relmfu
http://www.youtube.com/watch?v=QSPXXhmwYf4&feature=relmfu
How to - Articles & User Guides & Tutorials
http://www.iphone-mac.com/index.php/Index/howto/id/4/type/select
iPad How-Tos http://ipod.about.com/lr/ipad_how-tos/903396/1/
You can download this guide to your iPad.
iPad User Guide for iOS 5
http://itunes.apple.com/us/book/ipad-user-guide-for-ios-5/id470308101?mt=11
Cheers, Tom -
Highlighting Min and Max Values on each line
Hello,
Is it possible to highlight the Min and Max values on each row of a Query. For example I have sales below by product line for the last seven quarters. The user
would like the Max value (150) for Product Line ABC Highlighted as Green and the Min value (1055) color coded as Red. Like wise for each line - DEF 200 as green and 100 as red and GHI - 400 as green and 100 as red.
FYQ Q207 Q307 Q407 Q108 Q208 Q308 Q408
ABC 1500 1200 1400 1050 1100 1100 1100
DEF 1550 1000 1560 1220 1340 1640 2000
GHI 1000 2000 3000 4000 3250 2220 3750
Is this possible using Exceptions? or may be any other means? We are on Bex 7.0
Best Regards,
SanjivHello Sanjiv,
I think it can be done by JavaScript, but needs more effort
[Use of JavaScript Functions|http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a853bc623c075e10000000a114084/content.htm]
Try the exception available in the BW[BW Stylesheets|http://help.sap.com/saphelp_nw04/helpdata/en/3f/ca453afbf37b54e10000000a11402f/content.htm]
SAPBEXformats - Formatting cell (scaling factors)
SAPBEXexcGood1 - Exception with priority good 1
SAPBEXexcGood2 - Exception with priority good 2
SAPBEXexcGood3 - Exception with priority good 3
SAPBEXexcCritical4 - Exception with priority critical 4
SAPBEXexcCritical5 - Exception with priority critical 5
SAPBEXexcCritical6 - Exception with priority critical 6
SAPBEXexcBad7 - Exception with priority bad 7
SAPBEXexcBad8 - Exception with priority bad 8
SAPBEXexcBad9 - Exception with priority bad 9
See this thread,
Change the colour of a cell text depending on the value Web Reports (NW04s)
Thanks
Chandran
Edited by: Chandran Ganesan on Mar 19, 2008 4:27 PM -
Quality parameter -min and max values should be maintained w.r.to contract?
Hi all,
Min and max values in quantity contract should be maintained with respect to contract. till now we were maintaing min and max values with respect to inspection plans, but here since it differs for customer/vendor contracts - it need to be with respect to that. kindly suggest me on this
regards,
SoumyaIn the Material Assignment TAB of the Inspection Plan Header, you can maintain or assign Vendor/Customer. These specifications will be assigned automatically for the Purchase Orders/Sales Orders for the Material/Vendor or Material /Customer Combination at Plant Level.
Check this and revert back.
Best Regards,
Raghavendra Nayak
Maybe you are looking for
-
data rescue 3 external drive recovery .Invisible external hard disk 1 tb., I want a refund.
-
I can't figure out to print any webpage.
I do not see any print button and the pull down menu (after clicking the mouse) does not include a printing option. Thank you!
-
I've just made the move from Entourage to Mail. I have a ton of mail that I am now in the process of resorting. (long overdue) Sometimes I get this message - "The message "Subject" could not be moved to the mailbox "New Email Storage/directory"" Some
-
Blinking folder with question mark at start up
When i turned on my iMac I was surprised to see a folder icon blinking as it was running fine before this. I didn't delete or install anything. My DVD drive does not read properly so i am unable to boot from the installation disk, tried to boot using
-
Hello all, I am New to Inventory, I have created Stock Locator Key FF ( R12.1.3) and compiled successfully. I am facing Issue while enter the Stock Locator in Inventory I got below error. APP-FND-00914: Required flexfield segment is empty but not dis