Each row into one idoc
hello all,
here i have a basic problem ,
i am given a text file ie. note pad which has around 100 rows ,
each row represents each employee details,
now i have to convert each row into 1 idoc,
for this i had created one datatype whose structure coincides with the employee fields and after creating the message interface i mapped it with the all ready imported idoc,can any one tell me how to further with little details, any help will be appreciated ,its very urgent, thank you.
Hi Kutumba,
In ID u need to create atlest one business service with a Sender File Communication Channel to receive the file and one Business System for the R/3 System with a Receiver IDoc Communication Channel to receive the Idoc XML.
U also need to create the Receiver and the Sender Agreements.
U can also go through this link:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6bd6f69a-0701-0010-a88b-adbb6ee89b34
Try doing this and let me know if u face any further problems.
Regards
Neetu
Similar Messages
-
Dear FI Idoc Gurus,
Iu2019m using basic type PEXR2002 , this idoc is generated when I do a payment run via F110. The idoc generation as far as I know is standard , with some enhancement done via user exit - EXIT_SAPLIEDP_902.
Currently for each payment document generated one IDOC is created . The Business document / payment document is per vendor. Hence each vendor I get one IDOC .
Client is asking if I can combine payments of various vendors into one IDOC ? is this possible? Is it possible through heavy customization?
Please assist thank you.
Best WishesHi,
I guess its very difficult to combine the different vendor IDOC into single IDOC and require the customized development.
Instead you can collect the different vendor IDOC based on the specific parameter. so that all the IDOC will get collected and send as a single message or single file. for this you can use the IDOC collect functionality. -
Merging rows into one row but into SEPARATE Columns
Hello Gurus,
I have searched alot on OTN and many other places, but no where I could get the solution of how can we merge rows into one row but separate column. For example
Consider the below scenario
"DEPARTMENT", "EMP","NAME","SUBJECT"
"Electronics","1","Sam","LIC"
"Electronics","2","Pam","VLSI"
"Electronics","3","Tom","C"
"Mech","1","Abu","Thermo"
"Mech","4","Lina","Machines"Now, I need the output like
Based on Department as Group By Clause
"DEPARTMENT", "EMP1","NAME1","SUBJECT1","EMP2","NAME2","SUBJECT2","EMP3","NAME3","SUBJECT3"
"Electronics","1","Sam","LIC","2","Pam","VLSI","3","Tom","C"
"Mech","1","Abu","Thermo","4","Lina","Machines"
The row data to be loaded into separate columns. Name of the column is not an issue... can be anythingIn all the forums which I went through I could find them loading into a single column, but not into respective separate columns.
Any help would be much appreciated.
Thanks848265 wrote:
Frank,
I saw your name nearly n number of times, as I went through many forums today... And the link which you have just posted, I went through it today afternoon.
Could you please explain this bit taken from your dynamic pivot post.
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;Many Thanks.You only need that when you need column aliases based on the actual data (and you explicitly said you don't need that) or when can't put an upper bound on the number of columns to be displayed. If that doesn't apply to this problem, then don't use any kind of dynamic SQL (like the code above); it makes the job much more difficult, less efficient and less robust.
Here's what the code above is doing.
If you were hard-coding a query that showed the number of people in each job, and you knew that the possible jobs were 'ANALYST', 'CLERK' and 'MANAGER', then you might hard-code a query like this:
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager
FROM scott.emp
GROUP BY deptno
;If the jobs had different names, or if there were not 3 different jobs, then you would have to change the lines in the SELECT clause that start with ", COUNT ( CASE ...".
The code you posted is from an example of dynamic SQL, where you first run a Preliminary Query . (What you posted above is, in fact, the complete preliminary query.) The output of that preliminary query is exactly the variable part of the real query, such as:
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS managerYou then use this output as part of your main query. In other words, you can write something today that will generate exacrly as many columns as you need next year, with names from the data as it is next year. How? because you're not writing the full query today. The variable part will be written by the preliminary query when it runs next year. -
How to coalesce many rows into one?
I am using SSMS 2008 R2 and am simply trying to coalesce many rows into one. This should be simple I think, but it is currently repeating data in each row. Consider:
create table test
Name varchar(30)
insert test values('A'),('B'),('C')
select * from test
select distinct Name, coalesce(Name + ', ', '')
from test
How can I rewrite this to achieve one row like: A,B,C
Ryan DOr as a variation
Declare @S varchar(MAX)
set @S = ''
select @S = @S + ', ' +Name
from test
Select substring(@s, 2, length(@s))
Would be interested to know performance difference between this style and the XMLPath used by Naomi though. The XMLPath technique certainly looks cleaner
A samll correction for RyanAB's solution:
Select substring(@s, 2, len(@s))
For more information about Len(), please see:
http://technet.microsoft.com/en-us/library/ms190329.aspx
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support -
List aggregate two rows into one
query :
select kod_negeri.NAMA kod_negeri_nama,
hakmilik.id_hakmilik,
MOHON.PENYERAH_NAMA,
MOHON.PENYERAH_ALAMAT1, MOHON.PENYERAH_ALAMAT2, MOHON.PENYERAH_ALAMAT3,
MOHON.PENYERAH_ALAMAT4, MOHON.PENYERAH_POSKOD, MOHON.PENYERAH_KOD_NEGERI,
MOHON.PENYERAH_NO_RUJ, MOHON.ID_MOHON, HAKMILIK.KOD_HAKMILIK, HAKMILIK.NO_HAKMILIK,
KOD_LOT.NAMA, HAKMILIK.NO_LOT, KOD_BPM.NAMA, KOD_DAERAH.NAMA,
LELONG.TMPT, LELONG.DIMASUK, PGUNA.NAMA,
PIHAK.ALAMAT1, pihak.NAMA ven,
PIHAK.ALAMAT2, PIHAK.ALAMAT3, PIHAK.ALAMAT4, PIHAK.POSKOD,
mohon.id_mohon ,
pguna.NAMA pguna_nama,
pguna.JAWATAN,
kod_daerah.NAMA kod_daerah_nama,
to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,
to_char(lelong.TRH_lelong,'DD')||' '|| to_char(lelong.trh_lelong,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_lelong, 'YYYY') trh_le,
to_char(lelong.trh_lelong, 'Day') day,
to_char(lelong.TRH_lelong,'HH12:MI ') hour,
DECODE(SUBSTR(to_char(lelong.TRH_lelong,'HH12:MI AM'),-2,2),'AM','Petang','pagi') noon,
enkuiri.cara_lelong,
lelong.TMPT,
lelong.HARGA_RIZAB,
enkuiri.harga_rizab,
initcap(pihak.NAMA) pihak_nama,
initcap(lelong.EJA_RIZAB) er,
'RM'||enkuiri.TUNGGAK_AMAUN,
lelong.DEPOSIT,
convert_number_words(lelong.DEPOSIT) as converted_form,
to_char(lelong.TRH_AKHIR_BYR,'DD')||' '|| to_char(lelong.TRH_AKHIR_BYR,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_AKHIR_BYR, 'YYYY') TRH_AKHIR_BYR,
to_char(sysdate,'DD') ||' '|| to_char(sysdate,'MONTH','nls_date_language=malay') ||' '||to_char(sysdate,'yyyy') sysd,
kod_bpm.NAMA kod_bpm_nama,
kod_lot.NAMA kod_lot_nama,
hakmilik.NO_LOT,
hakmilik.KOD_HAKMILIK,
hakmilik.NO_HAKMILIK
from
mohon ,
mohon_hakmilik ,
lelong ,
pguna ,
pihak ,
kod_daerah ,
enkuiri ,
kod_bpm ,
hakmilik ,
kod_lot ,
kod_negeri,
mohon_fasa ,
kod_hakmilik
WHERE mohon.id_mohon = mohon_hakmilik.id_mohon and
mohon_hakmilik.id_hakmilik = hakmilik.id_hakmilik and
hakmilik.kod_hakmilik = kod_hakmilik.kod(+) and
hakmilik.kod_lot = kod_lot.kod(+) and
hakmilik.kod_bpm = kod_bpm.kod(+) and
hakmilik.kod_daerah = kod_daerah.kod(+) and
mohon.id_mohon = enkuiri.id_mohon and
lelong.id_pihak = pihak.id_pihak and
lelong.id_mh = mohon_hakmilik.id_mh and
pihak.kod_negeri = kod_negeri.kod(+) and
mohon.id_mohon = mohon_fasa.id_mohon and
mohon_fasa.id_aliran ='semakan' and
mohon_fasa.id_pguna = pguna.id_pguna and
mohon.id_mohon = :p_id_mohon
and enkuiri.KOD_STS='AK'
and mohon.id_mohon ='0405AUC2010007436'KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM,151,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
,050540HSD00022923,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,HSD,22923,Lot,0009838,Mukim Jimah,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,no2,Ali Bin Abudillah,jalan 3,taman permata,lorong mentari,32333,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ali Bin Abudillah,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Jimah,Lot,0009838,HSD,22923
KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM and HSD,151 and 22923,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
that means i need to list aggregate the two rows into one how to make the changes for the above query in order to do so .
Edited by: user9093689 on Feb 9, 2011 10:03 PMuser9093689 wrote:
now need to bother abt this that line converts date into malay language
to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,iam retriving two rows of output, wat i need is to display one row and the second row values which are not similar should be added to the first row
for example for column
kod_hakmilik two rows values are
PM
HSD
but they should be display as
PM and HSD
finally my aim is to retrieve only one row as output.
i dont how exactly the term listaggr . how ever it may be whether using groupby or any other but the output should be as aboveWhat version of Oracle are you on?
Look up the LISTAGG() function in the documentation for your version (assuming it is there) and see if it can do what you want -
Breaking up of, One IDoc to many IDocs & combing Many IDocs into one IDoc?
Does anybody have any sample code of:
Splitting an IDoc into multiple IDocs and
Combining many similar IDocs into one IDoc
Any pointers will be appreciated.
Regards
MaheshThis is the code for splitting of an inbound idoc into multiple idoc
REPORT ztemp no standard page heading .
******************Data Declaration for selection screen***************
TABLES: edidc,edidd.
CALL SELECTION-SCREEN 9000.
SELECTION-SCREEN: BEGIN OF SCREEN 9000,
BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: idocno FOR edidc-docnum.
SELECTION-SCREEN:END OF BLOCK b1 ,
END OF SCREEN 9000.
*******************Data Declaration ************************************
DATA : it_contrl LIKE TABLE OF edidc WITH HEADER LINE,
it_hdata LIKE TABLE OF edidd WITH HEADER LINE,
it_fdata LIKE TABLE OF edidd WITH HEADER LINE,
it_gdata LIKE TABLE OF edidd WITH HEADER LINE,
it_data LIKE TABLE OF edidd WITH HEADER LINE,
it_status LIKE TABLE OF bdidocstat WITH HEADER LINE,
it_bdwfretvar LIKE TABLE OF bdwfretvar WITH HEADER LINE,
it_bdi_ser LIKE TABLE OF bdi_ser WITH HEADER LINE,
it_ldata LIKE TABLE OF edidd WITH HEADER LINE,
it_tede2 LIKE tede2,
vbeln LIKE vbak-vbeln,
idocnum LIKE edidc-docnum,
result LIKE bdwfap_par-result,
it_stat LIKE edids.
DATA : count TYPE i ,
counter TYPE i ,
temp TYPE i VALUE 1 ,
line TYPE i ,
tab LIKE sy-tabix.
*********************passing values to control record*****************
it_contrl-direct = '2'.
it_contrl-rcvprn = 'ID3IDES802'.
it_contrl-rcvprt = 'LS'.
it_contrl-doctyp = 'ORDERS05'.
it_contrl-idoctp = 'ORDERS05'.
it_contrl-sndpor = 'ZSOFI'.
it_contrl-sndprt = 'LI'.
it_contrl-sndprn = '1000'.
it_contrl-mestyp = 'ORDERS'.
APPEND it_contrl.
************************Select query for data*************************
SELECT * FROM edid4 INTO CORRESPONDING FIELDS OF TABLE it_fdata
WHERE docnum IN idocno.
SELECT * FROM edid4 INTO CORRESPONDING FIELDS OF TABLE it_data
WHERE docnum IN idocno AND segnam NOT LIKE 'E1EDP%' .
SELECT * FROM edid4 INTO CORRESPONDING FIELDS OF TABLE it_hdata
WHERE docnum IN idocno AND segnam LIKE 'E1EDP%'.
**************select query to count the no of E1EDP01 segment*********
SELECT COUNT( * ) FROM edid4 INTO count WHERE docnum IN idocno AND
segnam = 'E1EDP01'.
*************to determine the no of idocs to be generated************
count = count / 5.
PERFORM datasplit.
**********************************for remaining idocs*****************
counter = count MOD 5.
IF counter NE 0.
PERFORM dataremain. .
ENDIF.
*& Form datasplit
text
--> p1 text
<-- p2 text
FORM datasplit .
LOOP AT it_data.
MOVE-CORRESPONDING it_data TO it_gdata.
APPEND it_gdata.
ENDLOOP.
DO count TIMES.
PERFORM split.
perform idoccreate.
enddo.
ENDFORM. " datasplit
*& Form SPLIT
text
--> p1 text
<-- p2 text
FORM split .
LOOP AT it_hdata.
IF temp <= 5.
ON CHANGE OF it_hdata-segnam.
IF it_hdata-segnam = 'E1EDP01'.
MOVE-CORRESPONDING it_hdata TO it_gdata.
APPEND it_gdata.
ELSE.
MOVE-CORRESPONDING it_hdata TO it_gdata.
APPEND it_gdata.
temp = temp + 1.
ENDIF.
ENDON.
ENDIF.
ENDLOOP.
ENDFORM. " SPLIT
*& Form dataremain
text
--> p1 text
<-- p2 text
FORM dataremain .
CLEAR it_gdata[].
LOOP AT it_data.
MOVE-CORRESPONDING it_data TO it_gdata.
APPEND it_gdata.
ENDLOOP.
LOOP AT it_hdata .
IF sy-tabix > 10.
MOVE-CORRESPONDING it_hdata TO it_gdata.
APPEND it_gdata.
ENDIF.
ENDLOOP.
perform idoccreate.
ENDFORM. " dataremain
*& Form idoccreate
text
--> p1 text
<-- p2 text
form idoccreate .
***********************for creating the inbound idocs****************
CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
EXPORTING
pi_status_message = it_stat
pi_do_handle_error = 'X'
PI_NO_DEQUEUE = ' '
pi_return_data_flag = 'X'
PI_RFC_MULTI_CP = ' '
IMPORTING
pe_idoc_number = idocnum
pe_state_of_processing = sy-subrc
pe_inbound_process_data = it_tede2 "for process code
TABLES
t_data_records = it_gdata
T_LINKED_OBJECTS =
CHANGING
pc_control_record = it_contrl
EXCEPTIONS
IDOC_NOT_SAVED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK.
*it_contrl-status = '64'.
modify it_contrl index 1.
****************for posting the idoc**************************
CALL FUNCTION 'IDOC_INPUT_ORDERS'
EXPORTING
input_method = 'A'
mass_processing = '1'
IMPORTING
workflow_result = result
APPLICATION_VARIABLE =
IN_UPDATE_TASK =
CALL_TRANSACTION_DONE =
DOCUMENT_NUMBER = vbeln
TABLES
idoc_contrl = it_contrl[]
idoc_data = it_gdata[]
idoc_status = it_status[]
return_variables = it_bdwfretvar[]
serialization_info = it_bdi_ser[]
EDI_TEXT =
EDI_TEXT_LINES =
CLEAR : it_contrl-docnum.
COMMIT WORK.
endform. " idoccreate -
How to combine many rows into one row
Hi all,
I have a question regarding to how to combine many rows into one row?
My result set is like that:
ITEM_NO NAME1
11 abc
11 cde
11 fg
Want to combine them into
ITEM_NO NAME1
11 abc;cde;fg
would anybody can tell me how to do that? Thanks
RayYou can check this --
satyaki>
satyaki>
satyaki>create table t
2 as
3 select 11 ITEM_NO, 'abc' NAME1 from dual
4 union all
5 select 11 ITEM_NO, 'cde' NAME1 from dual
6 union all
7 select 11 ITEM_NO, 'fg' NAME1 from dual;
Table created.
satyaki>
satyaki>
satyaki>
satyaki>set lin 10
satyaki>
satyaki>desc t;
Name Null? Type
ITEM_NO NUMBER
NAME1 VARCHAR2(3)
satyaki>
satyaki>
satyaki>set lin 1000
satyaki>
satyaki>
satyaki>
satyaki>SELECT ITEM_NO,
2 LTRIM(MAX(SYS_CONNECT_BY_PATH(NAME1,';'))
3 KEEP (DENSE_RANK LAST ORDER BY curr),';') AS NAME1_DET
4 FROM (SELECT ITEM_NO,
5 NAME1,
6 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) AS curr,
7 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) -1 AS prev
8 FROM t)
9 GROUP BY ITEM_NO
10 CONNECT BY prev = PRIOR curr AND ITEM_NO = PRIOR ITEM_NO
11 START WITH curr = 1;
ITEM_NO NAME1_DET
11 abc;cde;fgRegards.
Satyaki De. -
A way to roll up rows into one row
Is there a way to "roll up" a set number of rows into one row? I would like to have a row that can be expanded into several rows by clicking a plus sign or something similar. Anyway to do this?
Regards,
MarkMark,
Sorry, it didn't occur to me that you meant "hiding". It sounds like you already know how to hide and unhide but unfortunately there are no shortcuts. I agree that it would be nice to have a way to unhide a selected row or column and if my memory serves me I submitted a request for this feature some months ago. May I suggest that you also go to Main Menu > Numbers > Provide Numbers Feedback.
The more requests for features they receive the better the chance for getting them in future updates. Best wishes,
pw -
Combining multiple rows into one row
Hi all.
My most humble apology for this question but solutions in previous threads did not seem to help much.
Apparently, my account has not been verified and I am currently at home with no access to the SQL code so i can't post the actual code.
We have this (mockup) of code
Select S.C1, AViewSS.Study, AViewSS.SlotName, IST.TakenByDate, IST.ScannedByTime, SE.TimepointCalculation
From IST
INNER JOIN
AViewSS ON IST.GroupID = AViewSS.GroupID and
IST.SlotID = AViewSS.SlotID
INNER JOIN
S ON AViewSS.StudyID = S.StudyID
INNER JOIN
SE ON IST.Line = SE.Line and IST.SubLine = SE.SubLine and
AViewSS.ScheduleID = SE.ScheduleID
WHERE
(IST.GroupID = 92) and (IST.SlotID between 1791 and 1795)
and (AViewSS.VisitID = 137)
The query currently returns this result set
Col 1 Col 2 Taken Date Date 1 Date 2 Date 3
Scanned DateTime
Data Data 3/12/2015 3/12/2015 7:22
3/12/2015 7:22
Data Data 3/12/2015 3/12/2015 8:47
3/12/2015 8:47
Data Data 3/12/2015
3/12/2015 9:27 3/12/2015 9:27
Data Data 3/22/2015 3/22/2015 7:27
3/22/2015 7:27
Data Data 3/22/2015
Data Data 4/12/2015
Data Data 4/12/2015
Data Data 4/12/2015
You’ll notice that rows 1, 2, 3 are related as are rows 4, 5 and rows 6, 7, 8.
This is what we ultimately want to see given the results above.
In the report, rows 1, 2, 3 from the results should roll into one row with the ScannedByTimeStamp from each row returned by the query populating the appropriate report time column based on the value of a column in the row.
Col 1 Col 2 Taken Date Date 1 Date 2
Date 3
Data Data 3/12/2015 3/12/2015 7:22 3/12/2015 8:47 3/12/2015 9:27
Data Data 3/22/2015 3/22/2015 7:27
Data Data 4/12/2015
We would appreciate any guidance.Hi Duane,
The table and matrix data regions can display complex data relationships by including nested tables,matrices, lists, charts and gauges. Tables and matrices have a tabular layout and their data comes from a single dataset, built on a single data source. The
key diference between tables and matrices is that tables can include only row groups, where as matrices have row groups and columns groups.
All Code in this sample are downloadable from
this URL
create procedure spMultiple
as
begin
declare @Mytable table ([Col 1] varchar(20),[Col 2] varchar(20),[Taken Date] varchar(20),[Date 1] varchar(20),[Date 2] varchar(20),[Date 3] varchar(20))
Insert into @Mytable ([Col 1],[Col 2],[Taken Date],[Date 1],[Date 2],[Date 3])
select * from
Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'3/12/2015 7:22' as [Date 1],'' as [Date 2],'' as [Date 3]
union all
Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'' as [Date 1],'3/12/2015 8:47' as [Date 2],'' as [Date 3]
union all
Select 'Data' as [Col 1],'Data' as [Col 2],'3/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'3/12/2015 9:27' as [Date 3]
union all
select 'Data' as [Col 1],'Data' as [Col 2],'3/22/2015' as [Taken Date],'' as [Date 1],'3/22/2015 7:27' as [Date 2],'' as [Date 3]
union all
select 'Data' as [Col 1],'Data' as [Col 2],'3/22/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
union all
select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
union all
select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
union all
select 'Data' as [Col 1],'Data' as [Col 2],'4/12/2015' as [Taken Date],'' as [Date 1],'' as [Date 2],'' as [Date 3]
) as temp;
with Mytable2(
[Col 1],
[Col 2],
[Taken Date],
[Date],
[NameDate]
as
SELECT
[Col 1],
[Col 2],
[Taken Date],
[Date],
[NameDate]
FROM
(SELECT
[Col 1],
[Col 2],
[Taken Date],
[Date 1],
[Date 2],
[Date 3]
FROM
@MyTable) as p
UNPIVOT
[Date] FOR [NameDate] IN ([Date 1],[Date 2],[Date 3])
)AS unpvt
group by
[Col 1],
[Col 2],
[Taken Date],
[Date],
[NameDate]
Select * from Mytable2 t1 where [date]<>''
end
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Ricardo Lacerda -
Collecting data from multiple rows into one column
I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
PL/SQL Release 10.2.0.5.0 - Production
"CORE 10.2.0.5.0 Production"
TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
CREATE TABLE "SKIP"."INGREDIENTS"
( "INGRED_ID" NUMBER,
"INGRED_NAME" VARCHAR2(20 BYTE),
"STORES" VARCHAR2(20 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.INGREDIENTS
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
CREATE TABLE "SKIP"."PRETZELS"
( "PRETZEL_ID" NUMBER,
"PRETZEL_NAME" VARCHAR2(20 BYTE),
"PRETZEL_DESC" VARCHAR2(100 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.PRETZELS
Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
CREATE TABLE "SKIP"."INGRED_XREF"
( "PRETZEL_ID" NUMBER,
"INGRED_ID" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.INGRED_XREF
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
-- Constraints for Table INGRED_XREF
ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
{code}
Desired output (note how the ingredients are all listed in one column, separated by commas):
{code}
PRETZEL_ID PRETZEL_NAME PRETZEL_DESC INGREDIENTS
1 CLASSIC Classic knot pretzel SEA SALT, TABLE SALT, YEAST
2 THICK STICK Straight pretzel, abt 1/2" in dia TABLE_SALT, FLOUR, BEERSee the FAQ : {message:id=9360005}
Especially links concerning string aggregation. -
I received a dozen pictures in a few emails and I saved them all into one file in pages. I just copied and pasted. I do not have the originals any longer. Iphoto will not permit me to import the pictures as it does not recognize a .pages file, nor can I simply click and drag from the pages document to iphoto nor from pages to the desktop to iphoto. How can I save each picture I guess back into a jpeg and then import them into iphoto or have i lost them to a pages document forever? This is urgent as I need the pictures made into a book on iphoto for work by Friday!!! Please advise! Thank you.
Greetings,
Locate the Pages document wherever it's located on your computer and click once on it to highlight it.
Go to File > Duplicate to make a backup copy of the file.
Click once again on the file to highlight it.
Go to File > Get Info
In the "Name & Extension" category remove the ".pages" extension and put in ".zip".
Close the info window and double-click the now renamed pages file (zip file now).It will decompress into a folder which contains all the base components including all the images you added. These can be dragged onto the iPhoto icon to import them.
Hope that helps. -
Can I convert each playlist into one single mp3 file
I have had great success creating and burning a playlist to a CD however I'd really prefer to save an ENTIRE playlist of about 20 songs as a SINGLE MP3 file. I can then I burn each file (composed of songs in a playlist) to a CD and have a nice set of organized music set/PLAYLISTS to listen to. I stated my question in this manner because I've seen many similar questions but they are not what I am asking. I am using WIndows 7
What I have tried:
1.) ...selecting the group of songs within the playlist and exporting as an MU3. My results: It created an MU3 file that played for less than 1 second when played in anything other than itunes. In itunes it opened as the same playist I began with
2.) ...consolidating the files (the goal was to consolidate into one MP3 file) but once I selected the consolidate option I could not find that file under itunes Media which is the location where itunes says it would be stored.
3.) ..converting to MP3 Result: It just converted each individual file to MP3 format and NOT the entire list as a SINGLE MP3 file.
Does anyone know if there is a way to accomplish this?
Thanks in advance
DSorry to disappoint you, Chris... but I don't "take their product". Someone WHO WORKS FOR THEM "gives it to me". There's a MAJOR DIFFERENCE between someone handing you something that's theirs to hand you... and stealing it.
In 2006 I saw Sara Evans "perform" in Tucson. She flew on her congressional (then) husband's private plane from Portland to Orange County, refueled and flew to Tucson, where she got into a limo, and rode to the show. She got out of the limo, went straight backstage, I saw someone hand her a Dr. Pepper, which she opened, took a sip out of, and then went out on the stage as the headline act for the evening. She sang six (6) songs in twenty-three (23) minutes, walked offstage, did no encore, and got back in the limo, which whisked her back to the waiting jet to fly home.
The station manager of the radio station that sponsored the concert, later told me that she was paid $125,000 for that twenty-three minutes. Even he felt like the station didn't get their money's worth. The promoter paid for the jet fuel and her pilots' salaries.
In 2009, I went out to Phil Vassar's "motor coach" after a show, which is basically a house on wheels. He showed two friends and I the "studio" in the middle of this converted bus, where he can record new tracks and send them straight to the record company via satelite, for their final editing. The front has a full kitchen & living room and a 50" flat screen TV with a massive audio system. HE owns the whole thing, and when he doesn't feel like riding, he has a private plane of his own that will pick him up wherever they can land and fly him to the next show. His promo guy gave each of us a copy of every CD he's ever released before we left.
I have no problem with people making money for their work. But I've seen just how much is given away in the music industry, and I'm not going to refuse things offered to me because someone with a private jet and limo, getting $6000 a minute, or with a half million dollar "rolling house" isn't getting paid for the things their own people are handing out in bulk. -
Each Row of one DataTable in a DataSet on a different page
HI.
I am making a report in Crystal Reports 2008. And I am building a .NET program to push an Access DB to the report.
I have a .NET DataTable object with my rows already in there merged into a .NET DataSet.
Then, I added the DataSet to a .NET CrystalReport object, and show it in a Windows Form.
I want each ROW of the Table to show on a different page. HOW? So, each row is entitled to a page or a new page if the row outrun the page.
Thank-you,
Ajay ShahHi Ajay,
This is a report design question, the data source does not matter.
I'm moving this post to the Designer forums.
Thanks
Don -
Consolidating three rows into one
Hello,
I am struggling to figure this out and my googling hasn't quite led me to what I need. I have found some ideas such as sys_connect_by_path but I want to convert my three rows into columns (using one row), not concatenate them. I can not quite find the right thing or work it out. The code below gives me the columns I want but I can not figure out how to consolidate it onto one row. When I uncomment the group by line it doesn't like it as the role and emp fields are not group expressions. The values I wish to pivot are strings and not numbers (role).
Would anybody be kind enough to help?? my brain has frozen!! :D
Thanks very much
Jon
With t As
Select 25840 id, 'Bob' emp, 'Primary' role From dual Union All
Select 25840, 'Jim', 'Secondary' From dual Union All
Select 25840, 'Dave', 'Tertiary' From dual
Select
id
,decode(role,'Primary',emp) Prim
,decode(role,'Secondary',emp) Sec
,decode(role,'Tertiary',emp) Ter
From
t
--group by idYou just need to add a MAX and uncomment the GROUP BY
SQL> ed
Wrote file afiedt.buf
1 With t As
2 (
3 Select 25840 id, 'Bob' emp, 'Primary' role From dual Union All
4 Select 25840, 'Jim', 'Secondary' From dual Union All
5 Select 25840, 'Dave', 'Tertiary' From dual
6 )
7 Select
8 id
9 ,max(decode(role,'Primary',emp)) Prim
10 ,max(decode(role,'Secondary',emp)) Sec
11 ,max(decode(role,'Tertiary',emp)) Ter
12 From t
13* group by id
SQL> /
ID PRIM SEC TER
25840 Bob Jim DavePersonally, I'd use a CASE rather than a DECODE, but that doesn't matter much.
Justin -
hi
Can we club two rows of a SQL statement into one , that is some column results from one row and other column result from second row, but the row must remain same .
thanks
imranSQL> with sample as (select 'A' supplier, 1000 total, 0 branch_total from dual
2 union all
3 select 'A' supplier, 0 total, 500 branch_total from dual
4 union all
5 select 'B' supplier, 300 total, 0 branch_total from dual
6 union all
7 select 'B' supplier, 0 total, 120 branch_total from dual)
8 SELECT SUPPLIER , SUM(TOTAL) , SUM(BRANCH_TOTAL) FROM SAMPLE
9 GROUP BY SUPPLIER
10 /
SUPPLIER SUM(TOTAL) SUM(BRANCH_TOTAL)
A 1000 500
B 300 120
Maybe you are looking for
-
Oracle Oracle SOA Suite 10g (10.1.3.1.0) with Oracle Forms
I need run an Oracle Forms 6i application on then web, after migration process that convert modules to Oracle Forms 10g modules, can i run my application on the Oracle Application Server latest version (Oracle Oracle SOA Suite 10g (10.1.3.1.0))?
-
Trailing spaces problem during file content conversion
I have developed a proxy to file scenario.And am using file content conversion for creating the file. The file is to be a fixed length file. File Structure <Header> <Item> <Item Trailer> <File Trailer> Each tab in the file has the last character mapp
-
Mac OS X Copying JavaApplicationStub using Java code
I have a java application that copies files from one folder to another. This works fine on Windows, but on Mac OS X a Unix executable file like JavaApplicationStub appearently does not like to be copied using Java... I have tested the application try
-
My ipod not connect with i tunes
my ipod not connect with i tunes
-
Color Swap Between Libraries: Is this Possible?
I work with a large number of Illustrator files daily that all use the Pantone Solid Coated library for their swatch color scheme. This color library will be used whether customers provide the art pieces or if I design the pieces for them. However, I