How to Group itab values....
Hi Experts,
I have created a report and inserted into itab. The values are
Matkl Pend.Qty. Pend Value.
=========================
SPG 5 100.00
SPG 3 300.00
SRG 2 300.00
SRG 7 800.00
Now i want to group matkl and total of Pendqty & value into another table.
How to do that.
Pl. give some idea.
Yusuf
HI,
DATA: itab type table of <your table> with key MATKL.
Now use.
COLLECT wa into ITAB.
COLLECT sums up all the numeric fields of the table if the KEY's of the records are same.
SO when push a WOrkarea into a table using PUSH if there exists a record with the key it just adds the value that is there in the workarea to the record.
Example:
DATA: BEGIN OF seats,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
seatsocc TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE HASHED TABLE OF seats
WITH UNIQUE KEY carrid connid.
SELECT carrid connid seatsocc
FROM sflight
INTO seats.
COLLECT seats INTO seats_tab.
ENDSELECT.
Regards,
Sesh
Similar Messages
-
How to group these values month by month ?
Hi,
I have a nice SQL statement which returns days by days, the values of a device.
WITH S1 AS
(SELECT DATE1,
ROUND(AVG(VALEUR),2) Debit
FROM EVV_E032
WHERE DATE1 BETWEEN TO_DATE('01012006000000', 'DDMMYYYYHH24MISS') AND TO_DATE('31122006235959', 'DDMMYYYYHH24MISS')
AND CLEF_VAR =
(SELECT CLEF_VAR FROM SITE_DEBIT_RIVIERE WHERE SITE = 'E032'
GROUP BY date1
SELECT NULL LINK ,
TO_CHAR(n, 'DD.MM'),
NVL(ROUND(AVG(Debit),2), 0) "Débit"
FROM
(SELECT TRUNC(TRUNC(to_date(2006,'YYYY'),'year'), 'DD')-1 + level n,
rownum jours
FROM dual CONNECT BY level<=366
) days
LEFT JOIN s1
ON days.n = TRUNC(date1,'DD')
GROUP BY n
ORDER BY nSample values :
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('10/02/2006 09:49:59','DD/MM/YYYY HH24:MI:SS') 1,63);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 10:35:12','DD/MM/YYYY HH24:MI:SS') 1,68);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 11:30:30','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 14:02:02','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 16:22:34','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('30/04/2006 18:09:08','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/05/2006 11:57:02','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('07/06/2006 15:11:58','DD/MM/YYYY HH24:MI:SS') 1,79);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('08/06/2006 20:00:26','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('19/06/2006 09:42:32','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 04:30:00','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 10:39:01','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('24/06/2006 19:34:50','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('26/06/2006 14:37:26','DD/MM/YYYY HH24:MI:SS') 1,88);The output are values grouped day by day. I would like to group tehse values month by month, but could not figure how to do. Even though I am not a newbie newbie on SQL, this code is going far too much for me. I know some of you guys can handle this. I tried hard but coud not succeed. Could you help me ?
Regards, Christian.Difficult to work out (read: too much hassle) with your data and sql, as you haven't provided a set of info for all the tables provided, but hopefully this will give you an idea:
with my_tab as (select trunc(sysdate)+30 dt, 1 val from dual union all
select trunc(sysdate) dt, 2 val from dual union all
select trunc(sysdate) dt, 20 val from dual union all
select trunc(sysdate)+30 dt, 10 val from dual union all
select trunc(sysdate)+60 dt, 6 val from dual)
-- end of mockup of table "my_tab"; see SQL below...
select trunc(dt, 'mm') dt, sum(val)
from my_tab
group by trunc(dt, 'mm')
order by trunc(dt, 'mm');
DT SUM(VAL)
01-MAR-09 22
01-APR-09 11
01-MAY-09 6 -
How to pass itab values into a smartform
hi everybody,
how can i pass the itab values from a report program to a smartform.
for ex:-
itab-bukrs, itab-lifnr, itab-budat.
can any one tell me where i have to define etc...
thanks
SantosiniHi
you can pass the itab values from a report program to a smartform.
like &itab-bukrs& & itab-lifnr&, & itab-budat&..you open any window and press change editor there you write fields like this.
first you create table type.in that you put all the fields which you want .then in form* interface* you put this table type name .
Edited by: Chaithanya A on Mar 21, 2008 8:17 AM
Edited by: Chaithanya A on Mar 21, 2008 8:17 AM -
How to display itab values in text boxes?
hi friends,
i am filling ITAB with some fields, now i have to get one by one field and i have to display this field values in textboxes in BSP layout page.
for exaple my ITAB contains 2 fields,
ID, NAME.
In layout there are two Input boxes.
now i have to display ITAB fields ID and NAME fields in layout inputboxes.
plz Any helps with some example code.......
Regards,
Shankar.hi shankar,
try this code Oninputprocessing event,
DATA: event type ref to cl_htmlb_event,
event = cl_htmlb_manager=>get_event( runtime->server->request ).
if event->id = 'btn'.
wa-id = '123'.
wa-name = 'abcd'.
append wa to itab.
if itab is not initial.
loop at itab into wa.
i_id = wa-id.
i_name = wa-name.
endloop.
endif.
endif.
Page attributes
i_id type string
i_name type string
Regards,
sri -
How to group the values with this partition over clause ?
Hi,
I have a nice request :
select c.libelle "Activité", sum(b.duree) "Durée"
from fiche a, activite_faite b,
activites c, agent d
where a.date_activite
BETWEEN TO_DATE('20/09/2009', 'DD/MM/YYYY') AND TO_DATE('26/10/2009', 'DD/MM/YYYY')
AND a.agent_id = 104
AND a.fiche_id = b.fiche_id
AND b.activites_id = c.activites_id
AND a.agent_id = d.agent_id
group by c.libelle
order by sum(b.duree)It gives me this nice result :
ACTIVITE DUREE
Tonte 27I want to get a percentage, i use ratio_to_report
select a.fiche_id, c.libelle "Activité", ratio_to_report(duree) over (partition by c.activites_id) * 100 "Durée"
from fiche a, activite_faite b,
activites c, agent d
where a.date_activite
BETWEEN TO_DATE('20/09/2009', 'DD/MM/YYYY') AND TO_DATE('26/10/2009', 'DD/MM/YYYY')
AND a.agent_id = 104
AND a.fiche_id = b.fiche_id
AND b.activites_id = c.activites_id
AND a.agent_id = d.agent_idIt gives me this less nice result :
Tonte 7,40740740740740740740740740740740740741
Tonte 33,33333333333333333333333333333333333333
Tonte 33,33333333333333333333333333333333333333
Tonte 25,92592592592592592592592592592592592593I would like to get this result :
Tonte 100I tried "grouping" values in the partition over clause but without success.
Any help appreciated from the slq-masters :
Regards,
ChristianChristian from France wrote:
I would like to get this result :
Tonte 100
Hi,
Why not this
select c.libelle "Activité", 100 "Durée"
from fiche a, activite_faite b,
activites c, agent d
where a.date_activite
BETWEEN TO_DATE('20/09/2009', 'DD/MM/YYYY') AND TO_DATE('26/10/2009', 'DD/MM/YYYY')
AND a.agent_id = 104
AND a.fiche_id = b.fiche_id
AND b.activites_id = c.activites_id
AND a.agent_id = d.agent_id
group by c.libelle
order by sum(b.duree)Because it would always be 100 (if you are taking as percentage) be what ever the count of duree be.
Or did I miss something in understanding the requirement.
Regards
Anurag -
How to group similar values using XQuery
I have a table Employee with following columns
EmpNo number,
Title varchar2(100),
First_Name varchar2(100),
Last_Name varchar2(100),
1, Miss, A, B (Sample record in Employee Table)
There is an audit table Employee_A with columns
ID number (PK),
EmpNo number,
Field_Name varchar2(100),
Old_Value varchar2(100),
New_Value varchar2(100)
An update statement causes the Title of EmpNo=1 to change from Miss to Mrs and Last_Name from B to C. Hence the audit table has two records
1,1,Title, Miss,Mrs
2,1,Last_Name, B, C
I need to generate an xml which is as follows:
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Title</Column>
<NewValue>Mrs</NewValue>
</Field>
<Field>
<Column>Last_Name</Column>
<NewValue>C</NewValue>
</Field>
<Data>
</Tag>
How can we do this using XQuery?
If not, can we do this using xmlelement, xmlagg?I tried the following:
SELECT XMLQuery('<Dummy>
{for $c in ora:view("Employee"),
$ca in ora:view("Employee_A")
let $emp := $c/ROW/EMPNO/text(),
$emp_a := $ca/ROW/EMPNO/text(),
$field := $ca/ROW/FIELD_NAME/text(),
$new := $ca/ROW/NEW_VALUE/text()
where $emp = $emp_a
return
<Tag>
<operation>Update</operation>
<key_id>$emp_a</key_id>
<Data>
<Field>
<Column>{$field}</ent_id>
<NewValue>{$new}</NewValue>
</Field>
</Data>
</Tag>
}</Dummy' RETURNING CONTENT)
FROM dual;
The output that I'm getting is
<Dummy
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Title</Column>
<NewValue>Mrs</NewValue>
</Field>
<Data>
</Tag>
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Last_Name</Column>
<NewValue>C</NewValue>
</Field>
<Data>
</Tag>
</Dummy>
Two <Tag></Tag> gets created - one for each update entry. Please help -
How to compare the value node of a for-each-group with other for-each-group
Hello!
I have a report in Oracle BI Publisher (10.1.3.2) with several data set. My XML schema is something like
<DATA>
<PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>111111</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>DEF</DESCRIPTION>
<VALUE>222222</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>67890</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>333333</VALUE>
</MY_PARAMETERS>
</PARAMETERS>
<NAMES>
<MY_NAMES>
<A_ID>12345</A_ID>
<NAME>ASDF</NAME>
</MY_NAMES>
<MY_NAMES>
<A_ID>67890</A_ID>
<NAME>EFGH</NAME>
</MY_NAMES>
</NAMES>
<VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>10987</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>26385</VALUE>
<DESCRIPTION>EFGHI</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>67890<A_ID>
<VALUE>24355</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
</VALUES>
</DATA>
I'm trying to build a rtf template in Word using this XML schema. The "A_ID" nodes in each group in my data have the same value. I want for each "A_ID" take the respective values in /DATA/VALUES/MY_VALUES.
<?for-each-group:MY_PARAMETERS;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ABC'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='DEF'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?/DATA/NAMES/MY_NAMES/VALUE?>
<?for-each-group:/DATA/VALUES/MY_VALUES;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ASDFG'?>
<?VALUE?> <---------------- I obtain for this node the '24355' and '10987' values
<?end when?><?end choose?>
I want to know how to obtain only '24355' value, this is, the value for A_ID (/DATA/VALUES/MY_VALUES) = A_ID (/DATA/PARAMETERS/MY_PARAMETERS).
Can someone help me?CREATE OR REPLACE TRIGGER "TEST_TRG"
BEFORE UPDATE OF "STATUS"
ON "TABLE1"
FOR EACH ROW
BEGIN
IF (:NEW.status = 'HOLD')
THEN
INSERT INTO table2
(status
VALUES (:NEW.status
END IF;
END;You should learn how to write PL/SQL code.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
How to set Default Value in People Group KFF
Hi
We are storing some information in People Group KFF which depends on Employee Category so if employee category is Permanent Headcount then the value in People group KFF will be different and if it is Temporary then the value will be different.
Now we want to default the People Group KFF value automatically based on Employee Category for a New Hire employee. And also we should be able to change the People Group KFF value for some new hire as there are few exceptions.
I tried WHEN-NEW-RECORD-INSTANCE and tried to set the value through INITIAL_VALUE but it is not working.
Kindly please advise if you have idea on how to implement this requirement.
Thanks
GauravHello Gaurav,
If I understood correctly, Your requirement is to update People Group segments based on employee category.
Basically you need to update people group values based on employee category before insert into assignment table.
You can acheive this using Dynamic Trigger on Assignment Table.
you need to change the new.people_group_id along with other segment values in this trigger logic.
Following articles will help you steps on how to create dyanamic triggers.
http://oracle.anilpassi.com/dynamic-triggers-in-hrms-payroll-demo.html
http://apps2fusion.com/apps/oracle-hrms/oracle-hr/204-triggers-in-oracle-hrms-and-payroll
Regards,
Saurabh -
How to compare group level value
Hi all,
I have prepared a very simple report like :
Group A: 60(maximum of this group A)
a1 40
a2 60
a3 20
Group B: 53
b1 46
b2 47
b3 53
GroupC: 89
c1 89
c2 87
c3 76
now i want to display the max value between (group B and group A )+ (value of group C) in a cell.
Thanks in advanceHi,
I think you will need to create a variable that excludes items in group C.
v_GroupC_excluded.
=if([Group]="C";-9999;[value])
then create a second variable with report contexts
v_MaxValue
=MAX([v_GroupC_excluded] In Report)
This can then be added to value when the group is C.
I have not been able to test this as I am currently reinstalling, but it should work. Let me know how you get on.
Regards
Alan -
How to get contiguous value as group
create table view_information(housenumber integer, device_no integer, Sdate data,edate date);
Secnarion 1:
insert into view_information values (6365533,0,to_date('2/27/2013 15:07','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 15:11','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 10:11','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 15:11','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 10:11','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 15:16','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 15:16','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 15:17','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 15:17','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 15:19','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 15:17','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 16:21','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 15:17','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 16:36','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 16:36','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 16:39','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 16:36','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 16:41','MM/DD/YYYY HH24:MI');
insert into view_information values (6365533,0,to_date('2/27/2013 16:36','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 16:42','MM/DD/YYYY HH24:MI');
select * from view_information
6365533 0 2/27/2013 15:07 2/27/2013 15:11
6365533 0 2/27/2013 10:11 2/27/2013 15:11
6365533 0 2/27/2013 10:11 2/27/2013 15:16
6365533 0 2/27/2013 15:16 2/27/2013 15:17
6365533 0 2/27/2013 15:17 2/27/2013 15:19
6365533 0 2/27/2013 15:17 2/27/2013 16:21
6365533 0 2/27/2013 15:17 2/27/2013 16:36
6365533 0 2/27/2013 16:36 2/27/2013 16:39
6365533 0 2/27/2013 16:36 2/27/2013 16:41
6365533 0 2/27/2013 16:36 2/27/2013 16:42
The result want to be ;
housenumber device_no Sdate edate group no
6365533 0 2/27/2013 15:07 2/27/2013 15:11 1
6365533 0 2/27/2013 10:11 2/27/2013 15:11 2
6365533 0 2/27/2013 10:11 2/27/2013 15:16 3
6365533 0 2/27/2013 15:16 2/27/2013 15:17 4
6365533 0 2/27/2013 15:17 2/27/2013 15:19 5
6365533 0 2/27/2013 15:17 2/27/2013 16:21 6
6365533 0 2/27/2013 15:17 2/27/2013 16:36 7
6365533 0 2/27/2013 16:36 2/27/2013 16:39 8
6365533 0 2/27/2013 16:36 2/27/2013 16:41 9
6365533 0 2/27/2013 16:36 2/27/2013 16:42 10
6365533 0 2/27/2013 10:11 2/27/2013 15:16 11
6365533 0 2/27/2013 15:16 2/27/2013 15:17 11
6365533 0 2/27/2013 15:17 2/27/2013 15:19 11
6365533 0 2/27/2013 10:11 2/27/2013 15:16 12
6365533 0 2/27/2013 15:16 2/27/2013 15:17 12
6365533 0 2/27/2013 15:17 2/27/2013 16:21 12
6365533 0 2/27/2013 10:11 2/27/2013 15:16 13
6365533 0 2/27/2013 15:16 2/27/2013 15:17 13
6365533 0 2/27/2013 15:17 2/27/2013 16:36 13
6365533 0 2/27/2013 10:11 2/27/2013 15:16 14
6365533 0 2/27/2013 15:16 2/27/2013 15:17 14
6365533 0 2/27/2013 15:17 2/27/2013 16:36 14
6365533 0 2/27/2013 16:36 2/27/2013 16:39 14
6365533 0 2/27/2013 10:11 2/27/2013 15:16 15
6365533 0 2/27/2013 15:16 2/27/2013 15:17 15
6365533 0 2/27/2013 15:17 2/27/2013 16:36 15
6365533 0 2/27/2013 16:36 2/27/2013 16:41 15
6365533 0 2/27/2013 10:11 2/27/2013 15:16 16
6365533 0 2/27/2013 15:16 2/27/2013 15:17 16
6365533 0 2/27/2013 15:17 2/27/2013 16:36 16
6365533 0 2/27/2013 16:36 2/27/2013 16:42 16
6365533 0 2/27/2013 10:11 2/27/2013 15:16 17
6365533 0 2/27/2013 15:16 2/27/2013 15:17 17
Secnarion 2:
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 4:46','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 4:46','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 5:41','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 5:42','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 6:21','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 6:23','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 6:37','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 6:38','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 7:18','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 7:19','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 9:08','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 9:10','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 10:02','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 10:04','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 10:04','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 10:06','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 10:04','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 10:11','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/27/2013 10:06','MM/DD/YYYY HH24:MI'),to_date('2/27/2013 10:11','MM/DD/YYYY HH24:MI');
insert into view_information values (6137402 ,0 ,to_date('2/28/2013 1:32','MM/DD/YYYY HH24:MI'),to_date('2/28/2013 1:34','MM/DD/YYYY HH24:MI');
select * from view_information
6137402 0 2/27/2013 4:46 2/27/2013 4:46
6137402 0 2/27/2013 5:41 2/27/2013 5:42
6137402 0 2/27/2013 6:21 2/27/2013 6:23
6137402 0 2/27/2013 6:37 2/27/2013 6:38
6137402 0 2/27/2013 7:18 2/27/2013 7:19
6137402 0 2/27/2013 9:08 2/27/2013 9:10
6137402 0 2/27/2013 10:02 2/27/2013 10:04
6137402 0 2/27/2013 10:04 2/27/2013 10:06
6137402 0 2/27/2013 10:04 2/27/2013 10:11
6137402 0 2/27/2013 10:06 2/27/2013 10:11
6137402 0 2/28/2013 1:32 2/28/2013 1:34
The result want to be ;
housenumber device_no Sdate edate group no
6137402 0 2/27/2013 4:46 2/27/2013 4:46 1
6137402 0 2/27/2013 5:41 2/27/2013 5:42 2
6137402 0 2/27/2013 6:21 2/27/2013 6:23 3
6137402 0 2/27/2013 6:37 2/27/2013 6:38 4
6137402 0 2/27/2013 7:18 2/27/2013 7:19 5
6137402 0 2/27/2013 9:08 2/27/2013 9:10 6
6137402 0 2/27/2013 10:02 2/27/2013 10:04 7
6137402 0 2/27/2013 10:04 2/27/2013 10:06 8
6137402 0 2/27/2013 10:04 2/27/2013 10:11 9
6137402 0 2/27/2013 10:06 2/27/2013 10:11 10
6137402 0 2/28/2013 1:32 2/28/2013 1:34 11
6137402 0 2/27/2013 10:02 2/27/2013 10:04 12
6137402 0 2/27/2013 10:04 2/27/2013 10:06 12
6137402 0 2/27/2013 10:02 2/27/2013 10:04 13
6137402 0 2/27/2013 10:04 2/27/2013 10:06 13
6137402 0 2/27/2013 10:06 2/27/2013 10:11 13
6137402 0 2/27/2013 10:02 2/27/2013 10:04 14
6137402 0 2/27/2013 10:04 2/27/2013 10:11 14
6137402 0 2/27/2013 10:04 2/27/2013 10:06 15
6137402 0 2/27/2013 10:06 2/27/2013 10:11 15
Regards
P.DharmarajWould you like to explain how the Group No's are being assigned?
Looks like you would be needing assistance of Analytic Functions Row_Number or Dense_Rank. Only if you can expain the logic to achieve the result, help is possible. -
How to group value in certain range ?
Hi all,
I have an ArrayList of double value (0.143554,0.999741,1.032341,4.976403,5.008995,8.973876,9.006459,
12.99214,13.03558,16.98777,17.0312,20.98247,21.03674,24.99796,
25.04136,28.99081,29.06675,32.96105,33.01528)
and I want to group the value to the closest 5 (starting from the minimum
value(0) of the list and ending at the maximum value(35) of the list).
Example :
0.143554 should become 0 (0.143554 < 0.5)
0.999741 should become 5 (0.5 <= 0.999741 < 5.5)
1.032341 should become 5 (0.5 <= 1.032341 < 5.5)
4.976403 should become 5 (0.5 <= 4.976403 < 5.5)
5.008995 should become 5 (0.5 <= 5.008995 < 5.5)
8.973876 should become 10 (5.5 <= 8.973876 < 10.5)
9.006459 should become 10 (5.5 <= 9.006459 < 10.5)
12.99214 should become 15 (10.5 <= 12.99214 < 15.5)
13.03558 should become 15 (10.5 <= 13.03558 < 15.5)
16.98777 should become 20 (15.5 <= 16.98777 < 20.5)
17.0312 should become 20 (15.5 <= 17.0312 < 20.5)
20.98247 should become 25 (20.5 <= 20.98247 < 25.5)
21.03674 should become 25 (20.5 <= 21.03674 < 25.5)
24.99796 should become 25 (20.5 <= 24.99796 < 25.5)
25.04136 should become 25 (20.5 <= 25.04136 < 25.5)
28.99081 should become 30 (25.5 <= 28.99081 < 30.5)
29.06675 should become 30 (25.5 <= 29.06675 < 30.5)
32.96105 should become 35 (30.5 <= 32.96105 < 35.5)
33.01528 should become 35 (30.5 <= 33.01528 < 35.5)
How could I do that..? Thanks
Edited by: azlicn on Jun 8, 2008 9:03 PM0.143554 should become 0 (0.143554 < 0.5)
0.999741 should become 5 (0.5 <= 0.999741 < 5.5)
1.032341 should become 5 (0.5 <= 1.032341 < 5.5)
4.976403 should become 5 (0.5 <= 4.976403 < 5.5)
5.008995 should become 5 (0.5 <= 5.008995 < 5.5)
8.973876 should become 10 (5.5 <= 8.973876 < 10.5)
9.006459 should become 10 (5.5 <= 9.006459 < 10.5)
12.99214 should become 15 (10.5 <= 12.99214 < 15.5)
13.03558 should become 15 (10.5 <= 13.03558 < 15.5)
16.98777 should become 20 (15.5 <= 16.98777 < 20.5)
17.0312 should become 20 (15.5 <= 17.0312 < 20.5)
20.98247 should become 25 (20.5 <= 20.98247 < 25.5)
21.03674 should become 25 (20.5 <= 21.03674 < 25.5)
24.99796 should become 25 (20.5 <= 24.99796 < 25.5)
25.04136 should become 25 (20.5 <= 25.04136 < 25.5)
28.99081 should become 30 (25.5 <= 28.99081 < 30.5)
29.06675 should become 30 (25.5 <= 29.06675 < 30.5)
32.96105 should become 35 (30.5 <= 32.96105 < 35.5)
33.01528 should become 35 (30.5 <= 33.01528 < 35.5)You just wrote the logic right there, put it in a switch statement and there ya have it. -
How to get each value from a parameter passed like this '(25,23,35,1)'
Hi
One of the parameter passed to the function is
FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
pi_flag_codes will be passed a value in this way '(25,23,35,1)'
How to get each value from the string
like 25 first time
23 second time
35 third time
1 fourth time
I need to build a select query with each value as shown below:-
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 25 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 23 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
(SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 35 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
group by t2.org_id) q3,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 1 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.chris227 wrote:
I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
select
regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
from dual
S1 S2 S3 S4
"25" "23" "35" "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
If t2.att_type is type of number you will do:
t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
I am using oracle 10g.
In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
say 25 is at 1 position.
23 is at 2
35 is at 3
1 is at 4.
the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
Please see the code I wrote for it, But the select query is having error:-
BEGIN
IF(pi_flag_codes IS NOT NULL) THEN
SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
*(SELECT '(25,23,35,1)' V_CNT FROM dual);*
DBMS_OUTPUT.PUT_LINE(V_CNT);
-- V_CNT := 3;
FOR L_CNT IN 0..V_CNT LOOP
if L_CNT=0 then
V_S_POS:=1;
V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
else
V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
end if;
if L_CNT=V_CNT then
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
else
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
end if;
VN_ATYPE := ' t2.att_type = ' || V_ID;
rec_count := rec_count +1;
query_no := 'Q' || rec_count;
Pls help me with fetching each value to build the where cond of the select query along with the query number.
Thank You. -
How to get selected value from selectOneRadio ???
Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
Plzzzzzzzz i need helpYou have a datatable in which each row is a question, correct?
Also in each row you have 5 possible answers that are in a radio, correct?
So,
You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
ex:
<h:selectOneRadio value="#{notas.selectedString}" id="rb">
<f:selectItem itemValue="#{notas.valuesList}"/>
</h:selectOneRadio>
Search the web for examples like yours. -
How to get column values on item added event receiver
Hi,
I have two columns in a document library and one is people or group column and the other one is choice column with check boxes.
I want to know how to read column values on Item Added event receiver, so that I can create if statements based on those values.
Thank you,
AA.Hi AOK2013,
Have you had a look at this Microsoft tutorial: http://msdn.microsoft.com/en-us/library/office/gg981880(v=office.14).aspx
Essentially, you want to use the AfterProperties property to access the changed field value.
E.g.
var personvalue = properties.AfterProperties["YourPersonFieldName"]
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
How to get the values of Select-options from the screen.
The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.
Hi,
Refer this following code..this will solve your problem...
"Following code reads value entered in s_po select options and willprovide search
"help for s_item depending upon s_po value.
REPORT TEST.
TABLES : ekpo.
DATA: BEGIN OF itab OCCURS 0,
ebelp LIKE ekpo-ebelp,
END OF itab.
SELECT-OPTIONS s_po FOR ekpo-ebeln.
SELECT-OPTIONS s_item FOR ekpo-ebelp.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
DATA:
dyn_field TYPE dynpread,
temp_fields TYPE TABLE OF dynpread,
zlv_dynpro TYPE syst-repid.
zlv_dynpro = syst-repid.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = zlv_dynpro
dynumb = syst-dynnr
request = 'A'
TABLES
dynpfields = temp_fields
EXCEPTIONS
OTHERS = 0.
LOOP AT temp_fields INTO dyn_field.
IF dyn_field-fieldname EQ 'S_PO-LOW'.
SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
WHERE ebeln EQ dyn_field-fieldvalue.
EXIT.
ENDIF.
ENDLOOP.
Maybe you are looking for
-
Is there no way at all I can get an older iTunes? :(
I really hate hate iTunes 11, I've tried getting used to it I can't deal with it. I've tried to iTunes 10 back with no luck. I've uninstalled every Apple thing on my computer, reinstalled 10, and rebooted. I've done this twice now and I'm still getti
-
Airport express, Airtunes, flashing amber
I picked up a new Airport Express this week. I bought it for the sole purpose of streaming iTunes from the iMac in the den to the home theater unit in the living room or the stereo in the shop. I have no need for wireless internet or wireless connect
-
Hi I have created a report and it gets displayed in ALV. My requirement was to put the whole code in a function module, including the ALV functionality...I have put the same..the problem is that I am not able to see the TOP-OF-PAGE.. I am putting a s
-
Losing My Mind (well..., maybe just my Internet Connection)
Hi All, I keep experiencing intermittent loss of my internet connection. When I do, I select the connection icon at the top of the page. Sometimes it lists my network, sometimes not. In any case, selecting it does not re-establish my connection. The
-
Export error and failing to render
I'm using Premiere Elements 7 and after editing a video, it is not letting me export it anywhere. I've tried numerous settings and I keep getting the same error message: Can anyone point me in the direction of what is going wrong and how I can fix it