Get multiple values into one field
I want to get following two rows into one record.
Thank you in advance!
ID Name Category
109 John C1
109 John D8
Result:
ID Name Category
109 John C1, D8
hi, i used centinul suggestion to create this is query.
WITH tablet AS
(SELECT '109' AS ID, 'John' AS NAME, 'C1' AS CATEGORY
FROM DUAL
UNION ALL
SELECT '109' AS ID, 'John' AS NAME, 'D8' AS CATEGORY
FROM DUAL)
SELECT ID, NAME,
LTRIM
(MAX (SYS_CONNECT_BY_PATH (CATEGORY, ','))KEEP (DENSE_RANK LAST ORDER BY ID),
) AS CATEGORY
FROM (SELECT ID, NAME, CATEGORY,
ROW_NUMBER () OVER (PARTITION BY ID ORDER BY CATEGORY)
AS curr,
ROW_NUMBER () OVER (PARTITION BY ID ORDER BY CATEGORY)
- 1 AS prev
FROM tablet)
GROUP BY ID, NAME
CONNECT BY prev = PRIOR curr AND ID = PRIOR ID
START WITH curr = 1;or
WITH tablet AS
(SELECT '109' AS ID, 'John' AS NAME, 'C1' AS CATEGORY
FROM DUAL
UNION ALL
SELECT '109' AS ID, 'John' AS NAME, 'D8' AS CATEGORY
FROM DUAL)
SELECT ID, NAME, SUBSTR (SYS_CONNECT_BY_PATH (CATEGORY, ','),
2)CATEGORY
FROM (SELECT ID, NAME, CATEGORY, COUNT (*) OVER (PARTITION BY ID) cnt,
ROW_NUMBER () OVER (PARTITION BY ID ORDER BY CATEGORY) seq
FROM tablet)
WHERE seq = cnt
START WITH seq = 1
CONNECT BY PRIOR seq + 1 = seq AND PRIOR ID = ID;Edited by: DeepakDevarapalli on Nov 12, 2009 2:45 PM
Edited by: DeepakDevarapalli on Nov 12, 2009 2:46 PM
Similar Messages
-
SQL Query -How2bring multiple results into one field using Formatted Search
Hi Everyone
i am trying to bring in the results of the field dbo.Lot_ITEM.LOT using a formatted search into a row level using the following query:
SELECT dbo.LOT_ITEM.LOT
FROM dbo.DLN1 INNER JOIN dbo.LOT_ITEM ON dbo.DLN1.ItemCode = dbo.LOT_ITEM.ITEM
WHERE dbo.LOT_ITEM.ITEM=$[DLN1.ItemCode]
however the result of the dbo.Lot_ITEM.LOT field could be more then one value depending on how many lots are assigned for that item
(for example this query would be similar to assigning batch/serial numbers to an item being despatched - as you can choose multiple batches/serials depending on the quantities available and required and then move from the left to the right side of the selection window) if that makes sense!
is it possible to bring in the multiple results into one field? and how can i amend the above query to include this?
Thankyou in advance :o)
Edited by: Asma Bi on Apr 23, 2008 7:22 PM
Edited by: Asma Bi on Apr 23, 2008 7:24 PMHi Suda
Thanks for replying :o) but im not sure about the query?
just to simplify it (as the query im working with is to do with 3rd party addons) i have used the serial/batchs field instead and used standard demo database fields from SBO 2005 sp01:
SELECT dbo.ixvSerialNoFact.SRI1_IntrSerial
FROM dbo.DLN1 INNER JOIN
dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
WHERE dbo.ixvSerialNoFact.ItemCode='g1000' and dbo.ixvSerialNoFact.SRI1_BaseEntry = '193'
The above brings me the relevant results but when i change it to be used in a formatted search:
SELECT dbo.ixvSerialNoFact.SRI1_IntrSerial
FROM dbo.DLN1 INNER JOIN
dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
WHERE dbo.ixvSerialNoFact.ItemCode=$[dln1.itemcode] and dbo.ixvSerialNoFact.SRI1_BaseEntry = $[dln1.DocEntry]
i cant seem to get it to work - now this may be because the serial number is not allocated until teh record is added to the system, however when this happens i am unable to go back in and manually trigger the query as the delivery note rows cannot be selected!
i think as what im originally wanting an answer for is same as this example, im wanting to know if this is even possible?
Thanks
Edited by: Asma Bi on Apr 24, 2008 3:53 PM
Edited by: Asma Bi on Apr 24, 2008 3:55 PM -
Storing and retrieving multiple values into one cookie.
Hi Everyone,
I am wondering if anybody knows of any good tutorials involving storing multiple values into one cookie. Any URLs will be greatly apprecated. Thanks heaps.
Regards
DavoThese are normally delimted in HTTP by a semicolon. You can concatenate the string yourself and on the reverse trip use StringTokenizer to get the values back out.
- Saish -
BI for NW04S: Concatenating multiple chars into one field in BI query
Hi,
We have BI for NW04S. We have a requirement of concatenating multiple characteristics into one field in the BI report. This single field should have the usual drill down and other olap functionalities that a single characteristic usually enjoy in a BI report.
In BI for NW04 (Not the S) this probably can be done using the table interface in WAD. However in BI7 WAD functionality are through Java.
Also can this be done using Query designer alone.
Can anybody help?
ThanksHi,
Can you please elaborate on your Query designer option. You can always have a variable and in the user exit can write code, but what is not clear that
1> How will you acheive the contatenation done for every row of the report in the BEX user exit variable( since it's called during the beginning of the query execution and not for all rows of the report
2> How do you transfer the char variable into a char field in the report.
Please elaborate .
Thanks -
Multiple Checkbox Values Into One Field
Hopefully someone can help me with this issue I'm having.
I'm trying to save the values of multiple selected checkboxes into one field separated by commas through ADDT's Insert Transaction code. I can do this easily with DW's standard insert record wizard by using the PHP implode() function but I haven't been able to figure it out with ADDT's code.
<form>
<input type="checkbox" value="1" name="program[]" /> Program One
<input type="checkbox" value="2" name="program[]" /> Program Two
<input type="checkbox" value="3" name="program[]" /> Program Three
<input type="checkbox" value="4" name="program[]" /> Program Four
</form>
THIS IS ADDT'S CODING
$ins_quoteManager->addColumn("programs", "STRING_TYPE", "POST", "programs");
THIS WORKS VIA DREAMWEAVER'S INSERT RECORD WIZARD
Original: GetSQLValueString($_POST['programs'], "text"),
Modified: GetSQLValueString(implode(',',$_POST['programs']), "text"),
Anyone know how to modify the ADDT code with the implode function to get this to work?Have you tried ADDT´s "comma-separated checkboxes" form control, which will also store the values into a field of your choice (and of course retrieve them from there on update record - pages) ? The only possible drawback might be, that the checkboxes can´t be defined statically, means that the array of value/label - pairs will be retrieved from another table by establishing an additional recordset.
Cheers,
Günter -
Problem in Showing multiple values into one text box.
Hi all,
How can show i multiple row values into one text box. here text box is multi line type.
i have one table it has content column, it has number of rows. i need to show those data into one text box in form. how can i solve it?
my sample code here,
egin
--:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
-- go_item('txt_from');
insert into chat(fromid,toid,content)values(:block3.fromid,:block3.toid,:block3.txt_From);
:block3.txt_From:= null;
commit;
:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
go_item('txt_from');
declare
cursor c4 is select content from chat where toid = :block3.fromid;
rec1 c4%rowtype;
begin
open c4;
loop
fetch c4 into rec1;
exit when c4%notfound;
null;
end loop;
end;
--select content into :block3.txt_to from chat where toid= :block3.fromid;
end;
please give me some tips to solve it.
thanks
gurusHi,
Try giving CHR(10) for line feed.
DECLARE
CURSOR C4 IS SELECT CONTENT FROM CHAT WHERE TOID = :BLOCK3.FROMID;
Str_Temp VARCHAR2(20);
BEGIN
:BLOCK3.TXT_TO := '';
OPEN C4;
LOOP
FETCH C4 INTO Str_Temp;
EXIT WHEN C4%NOTFOUND;
:BLOCK3.TXT_TO := :BLOCK3.TXT_TO || CHR(10) || Str_Temp;
END LOOP;
CLOSE C4;
END;Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
How do I insert multiple values into different fields in a stored procedure
I am writing a Stored Procedure where I select data from various queries, insert the results into a variable and then I insert the variables into final target table. This works fine when the queries return only one row. However I have some queries that return multiple rows and I am trying to insert them into different fields in the target table. My query is like
SELECT DESCRIPTION, SUM(AMOUNT)
INTO v_description, v_amount
FROM SOURCE_TABLE
GROUP BY DESCRIPTION;
This returns values like
Value A , 100
Value B, 200
Value C, 300
The Target Table has fields for each of the above types e.g.
VALUE_A, VALUE_B, VALUE_C
I am inserting the data from a query like
INSERT INTO TARGET_TABLE (VALUE_A, VALUE_B, VALUE_C)
VALUES (...)
How do I split out the values returned by the first query to insert into the Insert Statement? Or do I need to split the data in the statement that inserts into the variables?
Thanks
GB"Some of the amounts returned are negative so the MAX in the select statement returns 0 instead of the negative value. If I use MIN instead of MAX it returns the correct negative value. However I might not know when the amount is going to be positive or negative. Do you have any suggestions on how I can resolve this?"
Perhaps something like this could be done in combination with the pivot queries above, although it seems cumbersome.
SQL> with data as (
2 select 0 a, 0 b, 0 c from dual -- So column a has values {0, 1, 4},
3 union select 1 a, 2 b, -3 c from dual -- column b has values {0, 2, 5},
4 union select 4 a, 5 b, -6 c from dual ) -- column c has values {0, -3, -6}.
5 --
6 select ( case when max.a > 0 then max.a else min.a end) abs_max_a
7 , ( case when max.b > 0 then max.b else min.b end) abs_max_b
8 , ( case when max.c > 0 then max.c else min.c end) abs_max_c
9 from ( select ( select max(a) from data ) a
10 , ( select max(b) from data ) b
11 , ( select max(c) from data ) c
12 from dual ) max
13 , ( select ( select min(a) from data ) a
14 , ( select min(b) from data ) b
15 , ( select min(c) from data ) c
16 from dual ) min
17 /
ABS_MAX_A ABS_MAX_B ABS_MAX_C
4 5 -6
SQL> -
How to get multiple elements into one element as multiple occurences
I can't figure out how to do this. I have an input message that has multiple elements and I need to take those elements and copy them into one element with each new element going in as a new occurence or instance. For example
I have this input under one parent node.
element1
element2
element3
element4
and this is the output I need
Node
Element1[0]
Element2[1]
Element3[2]
Element4[3]
The input XML looks like this
Payload
Element1
Element2
Element3
and the output XML needs to look like this
Payload
Element.
Thanks in advanceHow about this.
Input XML:
<Row>
<Column1>TOTAL</Column1>
<Column_9_2_2008>900</Column_9_2_2008>
<Column_9_2_20082>890</Column_9_2_20082>
<Column_9_3_2008>52</Column_9_3_2008>
<Column_9_4_2008>0</Column_9_4_2008>
<Column_9_4_20082>0</Column_9_4_20082>
<Column_9_5_2008>0</Column_9_5_2008>
<Column_9_5_20082>0</Column_9_5_20082>
<Column_9_8_2008>0</Column_9_8_2008>
<Column_9_8_20082>0</Column_9_8_20082>
<Column_9_9_2008>0</Column_9_9_2008>
<Column_9_9_20082>0</Column_9_9_20082>
<Column_9_10_2008>0</Column_9_10_2008>
<Column_9_10_20082>0</Column_9_10_20082>
<Column_9_11_2008>0</Column_9_11_2008>
<Column_9_11_20082>0</Column_9_11_20082>
<Column_9_12_2008>0</Column_9_12_2008>
<Column_9_12_20082>0</Column_9_12_20082>
<Column_9_15_2008>0</Column_9_15_2008>
<Column_9_15_20082>0</Column_9_15_20082>
<Column_9_16_2008>0</Column_9_16_2008>
<Column_9_16_20082>0</Column_9_16_20082>
<Column_9_17_2008>0</Column_9_17_2008>
<Column_9_17_20082>0</Column_9_17_20082>
<Column_9_18_2008>0</Column_9_18_2008>
<Column_9_18_20082>0</Column_9_18_20082>
<Column_9_19_2008>0</Column_9_19_2008>
<Column_9_19_20082>0</Column_9_19_20082>
<Column_9_22_2008>0</Column_9_22_2008>
<Column_9_22_20082>0</Column_9_22_20082>
<Column_9_23_2008>0</Column_9_23_2008>
<Column_9_23_20082>0</Column_9_23_20082>
<Column_9_24_2008>0</Column_9_24_2008>
<Column_9_24_20082>0</Column_9_24_20082>
<Column_9_25_2008>0</Column_9_25_2008>
<Column_9_25_20082>0</Column_9_25_20082>
<Column_9_26_2008>0</Column_9_26_2008>
<Column_9_26_20082>0</Column_9_26_20082>
<Column_9_29_2008>0</Column_9_29_2008>
<Column_9_29_20082>0</Column_9_29_20082>
<Column_9_30_2008>0</Column_9_30_2008>
</Row>
Output XML:
<Total>
<Payload>900</Payload>
</Total>
<Total>
<Payload>890</Payload>
</Total>
<Total>
<Payload>52</Payload>
</Total> -
10GR2 - How can I load multiple row values into one field?
Hi
Can anyone please help with a problem I'm having with merging data.
The source table has multiple entries for the same Id e,g,
ID Code
1 123
1 234
2 123
2 567
The output should only have one row per ID e.g.
ID Code_List
1 123;234
2 123;567
Do you know what operator I could use that would allow me to do this? I've looked at unpivot but I think I would need multiple output fields (one for each Code). I have to concatinate the codes and separate with a semi-colon.
Thanks
GBQ) Input data
=============
COL_0,COL_4
1235,"G0123,G124,G25,G6"
1236,"G01,G23,G124,G25,G6"
1237,"G0123,G1,G24,G25,G6"
1238,"G,G0123,G124,G25,G6"
1239,"G0123124,G256"
Output
======
TEST_ID,TEST_VAL
1235,G0123
1235,G124
1235,G25
1235,G6
1236,G01
1236,G23
1236,G124
1236,G25
1236,G6
1237,G0123
1237,G1
1237,G24
1237,G25
1237,G6
1238,G
1238,G0123
1238,G124
1238,G25
1238,G6
1239,G0123124
1239,G256
I wrote this procedure...
declare
rcd_cnt number;
test_id123 number;
junk_1 number;
cd_occurences number;
child_count number;
str_abc varchar2(200);
char_pos number default 0;
cd_temp_str varchar2(50);--:= 'G0123,G124,G25,G6';
begin
select nvl(count(col_4),0) into rcd_cnt from test_ee where col_4 is not null;
for aa in 1 .. rcd_cnt loop
select col_0,rownum rn,nvl(trim(col_4),0) into test_id123,junk_1,cd_temp_str from (select col_0,rownum rn,col_4 from test_ee where col_4 is not null) where rn = aa;
--dbms_output.put_line('...I am in for loop...' || cd_temp_str);
--dbms_output.put_line('===================' || rcd_cnt || '.................' ||aa);
cd_occurences := length(cd_temp_str) - length(replace(cd_temp_str,','));
dbms_output.put_line(cd_temp_str || '...Str Occurences are ...'||cd_occurences ||'**************'||test_id123);
child_count :=0;
for z in 1..length(cd_temp_str)+1 loop
child_count := child_count+1;
if(instr(cd_temp_str,',') > 0) then
char_pos := instr(cd_temp_str,',',1,1);
str_abc := substr(cd_temp_str,1,char_pos-1);
dbms_output.put_line('..Partial String of..'|| z ||'..is.....' || str_abc);
insert into test_xx(test_id,test_val) values(test_id123,str_abc);
end if;
cd_temp_str := substr(cd_temp_str,char_pos+1,length(cd_temp_str));
if(cd_occurences=child_count) then
dbms_output.put_line('..Partial String of..is.....' || cd_temp_str);
insert into test_xx(test_id,test_val) values(test_id123,cd_temp_str);
end if;
end loop; -- close for of z */
--dbms_output.put_line('...I am in end for loop...');
end loop; -- close for of aa
end;
instead of procedure,is there any way from sqlqery. -
Updating multiple entries into one field
Hi i have a legal directory in which when a solicitor
registers they can select as many or as few areas of law they want.
I have all of the areas in a check box
<input type="checkbox" name="areaoflaw" value="Agricultural
Law">
<input type="checkbox" name="areaoflaw" value="Aviation
Law">
<input type="checkbox" name="areaoflaw" value="Charity
Law">
<input type="checkbox" name="areaoflaw" value="Civil
Liberties & Human Rights">
<input type="checkbox" name="areaoflaw" value="Computer
& IT Law">
<input type="checkbox" name="areaoflaw"
value="Construction & Civil Engineering">
<input type="checkbox" name="areaoflaw" value="Consumer
Problems">
<input type="checkbox" name="areaoflaw"
value="Conveyancing (non-UK)">
<input type="checkbox" name="areaoflaw" value="Corporate
Finance">
<input type="checkbox" name="areaoflaw" value="Dental
negligence">
<input type="checkbox" name="areaoflaw" value="Debt
Collection">
<input type="checkbox" name="areaoflaw" value="Defamation
Law">
<input type="checkbox" name="areaoflaw" value="European
Law">
<input type="checkbox" name="areaoflaw" value="Education
Law">
<input type="checkbox" name="areaoflaw"
value="Environmental Law">
<input type="checkbox" name="areaoflaw"
value="Enfranchisement & Lease extensions">
<input type="checkbox" name="areaoflaw" value="Fraud">
<input type="checkbox" name="areaoflaw" value="Insurance
Miss-selling">
<input type="checkbox" name="areaoflaw"
value="Intellectual Property">
<input type="checkbox" name="areaoflaw"
value="Landlord">
<input type="checkbox" name="areaoflaw" value="Tenant">
<input type="checkbox" name="areaoflaw" value="Licensing
Law">
<input type="checkbox" name="areaoflaw" value="Media &
Entertainment Law">
<input type="checkbox" name="areaoflaw"
value="Mediation">
<input type="checkbox" name="areaoflaw" value="Mental
Health">
<input type="checkbox" name="areaoflaw" value="Motoring
Offences">
<input type="checkbox" name="areaoflaw" value="Planning
Law">
<input type="checkbox" name="areaoflaw"
value="Professional Negligence">
<input type="checkbox" name="areaoflaw"
value="Pharmaceutical Claims">
<input type="checkbox" name="areaoflaw" value="Regulatory
Investigations">
<input type="checkbox" name="areaoflaw" value="Sports
Claims">
<input type="checkbox" name="areaoflaw" value="Shipping
Law">
<input type="checkbox" name="areaoflaw" value="Tax
Law">
<input type="checkbox" name="areaoflaw" value="Travel
& Tourism">
<input type="checkbox" name="areaoflaw" value="Welfare
Benefits">
When they submit i want it to insert as many areas as they
have selected but it only submits the last one checked.
<cfquery name="insertsolicitor" datasource="law4essex"
dbtype="odbc">
insert into
solicitors(companyname,contactname,address1,address2,town,county,postcode,tel,fax,email,w ebsite,areaoflaw)Values('#companyname#','#contactname#','#address1#','#address2#','#town#' ,'#county#','#postcode#','#tel#','#fax#','#email#','#website#','#areaoflaw#')
</cfquery>
Does anyone how i can add all or a few of them depending what
is selected. they should all go into the area of law field in the
databasecybertek23, I'd seriously reconsider doing an INSERT INTO
for these fields as a comma delimited list. This will undoubtedly
cause nothing but headaches in the near future. A better way might
be use each checkbox fieldname as its own column name in the dB.
In any case, see if this works for you:
<input type="checkbox" name="areaoflaw"
value="Agricultural Law">
<input type="checkbox" name="areaoflaw" value="Aviation
Law">
<input type="checkbox" name="areaoflaw" value="Charity
Law">
<input type="checkbox" name="areaoflaw" value="Civil
Liberties & Human Rights">
<input type="checkbox" name="areaoflaw" value="Computer
& IT Law">
<input type="checkbox" name="areaoflaw"
value="Construction & Civil Engineering">
<input type="checkbox" name="areaoflaw" value="Consumer
Problems">
<input type="checkbox" name="areaoflaw"
value="Conveyancing (non-UK)">
<input type="checkbox" name="areaoflaw" value="Corporate
Finance">
<input type="checkbox" name="areaoflaw" value="Dental
negligence">
<input type="checkbox" name="areaoflaw" value="Debt
Collection">
<input type="checkbox" name="areaoflaw" value="Defamation
Law">
<input type="checkbox" name="areaoflaw" value="European
Law">
<input type="checkbox" name="areaoflaw" value="Education
Law">
<input type="checkbox" name="areaoflaw"
value="Environmental Law">
<input type="checkbox" name="areaoflaw"
value="Enfranchisement & Lease extensions">
<input type="checkbox" name="areaoflaw" value="Fraud">
<input type="checkbox" name="areaoflaw" value="Insurance
Miss-selling">
<input type="checkbox" name="areaoflaw"
value="Intellectual Property">
<input type="checkbox" name="areaoflaw"
value="Landlord">
<input type="checkbox" name="areaoflaw" value="Tenant">
<input type="checkbox" name="areaoflaw" value="Licensing
Law">
<input type="checkbox" name="areaoflaw" value="Media &
Entertainment Law">
<input type="checkbox" name="areaoflaw"
value="Mediation">
<input type="checkbox" name="areaoflaw" value="Mental
Health">
<input type="checkbox" name="areaoflaw" value="Motoring
Offences">
<input type="checkbox" name="areaoflaw" value="Planning
Law">
<input type="checkbox" name="areaoflaw"
value="Professional Negligence">
<input type="checkbox" name="areaoflaw"
value="Pharmaceutical Claims">
<input type="checkbox" name="areaoflaw" value="Regulatory
Investigations">
<input type="checkbox" name="areaoflaw" value="Sports
Claims">
<input type="checkbox" name="areaoflaw" value="Shipping
Law">
<input type="checkbox" name="areaoflaw" value="Tax
Law">
<input type="checkbox" name="areaoflaw" value="Travel
& Tourism">
<input type="checkbox" name="areaoflaw" value="Welfare
Benefits">
<!--- ON THE PROCESSING PAGE, CREATE A VAR THAT'S BLANK
--->
<cfset listone = "">
<cfif isDefined("FORM.areaoflaw")>
<cfloop list="#FORM.areaoflaw#" index="i">
<!--- APPEND EACH CHECKBOX VALUE THAT WAS SUBMITTED
--->
<cfset listone = ListAppend(listone, "#i#")>
</cfloop>
</cfif>
<cfquery name="insertsolicitor" datasource="law4essex"
dbtype="odbc">
INSERT INTO solicitors
(companyname,contactname,address1,address2,town,county,postcode,tel,fax,email,website,are aoflaw)
VALUES
('#companyname#','#contactname#','#address1#','#address2#','#town#','#county#','#postcode #','#tel#','#fax#','#email#','#website#',
'#i#')
</cfquery>
------------------------------------------------------------------------------------------ -------------------------- -
Selecting Records based on multiple values in one field
Excuse the basic request.
I want to select all records from one table depending on the value in 2 specific fields. Each of these fields has a single value in it.
What I have written is as below
1.select nm_idno "EZAID", nm_fname, nm_lname, nm_et_tt "Position", nm_mt_mt "Status", nm_type, nm_wemal, nm_mailshot from MNME
2.where nm_type = 'M' and where nm_mailshot = 'Y' and nm_wemal > ' '
3.and where nm_mt_mt = (1 or 6 or 3 or 10) *** these are the bits that I don't understand why they will not work.
4. and where nm_et_tt = (408 or 329 or 283)
Basically every record should have one of the values I have highlighted in it.
Any help greatly appreciated.select nm_idno "EZAID"
,nm_fname
,nm_lname
,nm_et_tt "Position"
,nm_mt_mt "Status"
,nm_type
,nm_wemal
,nm_mailshot
from MNME
where nm_type = 'M'
and nm_mailshot = 'Y'
and nm_wemal > ' ' --< not sure what you mean here
and nm_mt_mt IN (1, 6, 3, 10)
and nm_et_tt IN (408, 329, 283)
; -
XML Unbounded values into one field - Message Mapping
Dear All,
I am trying to convert an unbounded multifield XML structure to a 0.1 field so that the maltiple values are mapped into a single fields in semi-colon seperated fasion.
The source:
<MT_dates>
<date>05-10-2011</date>
<date>10-11-2011</date>
<date>10-12-2011</date>
<date>10-13-2011</date>
</MT_dates>
date field is 0.. unbounded
target
<MT_dates>
<dates>05,10,2011;10,11,2011;10,12,2011;10,13,2011</date>
</MT_dates>
dates field is 0 .. 1
can anybody please help?
Regards,
Haikchk this:
input will be : var1
execution type All values of a context
int a = var1.length;
String b="";
for(int i=0;i<a;i++)
b =b +var1<i> + ";";
int c=b.length();
String output =b.substring(0,c-1)
result.addValue(output);
date-UDF--dates -
Export multiple tables into one flat file
I have data in multiple tables on a processing database that I need to move up to a production database. I want to export the data into a flat file, ftp it to the production server and have another job pick up the file and process it. I am looking for
design suggestions on how to get multiple tables into one flat file using SSIS?
Thank You.Hey,
Without a bit more detail, as per Russels response, its difficult to give an exact recommendation.
Essentially, you would first add a data flow task to your control flow. Create a source per table, then direct the output of each into an union all task. The output from the union all task would then be directed to a flat file destination.
Within the union all task you can map the various input columns into the appropriate outputs.
If the sources are different, it would probably be easiest to add a derived column task in-between the source and the union all, adding columns as appropriate and setting a default value that can be easily identified later (again depending on your requirements).
Hope that helps,
Jamie -
Store multiple values into a variable
I was wondering if it was possible to store multiple values into one varaible. Something along the lines of...
Oracle: 10g
--Table xSample (this is obviously a dumbed down version of the table for the sake of showing what I want to accomplish
S_ID YEAR
1 2009
2 2009
3 2009
4 2009
--Query
select s_id
into pID
from xSample
where year = 2009;Basically the reason I was trying to figure out how to store multiple values into a variable is b/c I was going to use that variable (pID) as a parameter and have it's values passed dynamically when the proc was called. The values would go into a query that would look something like:
select *
from cust_data
where person_id in (pID)
aka
select *
from cust_data
where person_id in (1,2,3,4)Not sure if this is possible, but if anyone knows of a way I could accomplish this that would be great.
Edited by: user652714 on Dec 23, 2009 9:37 AMHere's a basic idea building a comma seperated list, then consuming it in another query (taking the in list approach from Tom's post, linked earlier).
create table xsample (s_id number not null, year number);
insert into xsample select level, 2009 from dual connect by level <=4;
commit;
declare
--4000 should be lots ... hopefully?
v_parameter_list varchar2(4000);
begin
--create the comma seperated list
select
substr(max(sys_connect_by_path(s_id, ',') ), 2, 4000)
into
v_parameter_list
from
select s_id, row_number() over(order by 1) as rn
from xsample
where year = 2009
start with rn = 1
connect by prior rn = rn - 1;
--consume the comma seperated list
for x in
with data as
select
trim( substr (txt,
instr (txt, ',', 1, level ) + 1,
instr (txt, ',', 1, level+1)
- instr (txt, ',', 1, level) -1 ) ) as token
from
select ','||v_parameter_list||',' txt
from dual
connect by level <= length(v_parameter_list)-length(replace(v_parameter_list,',',''))+1
select *
from xsample
where s_id in (select * from data)
loop
dbms_output.put_line('next item = ' || x.s_id);
end loop;
end;
/ -
Get value of two fields into one field
Hellou,
i need little help with javascript again
Currently i'm using code below to get value from one field to other:
getField("Text35").value = getField("Text1").valueAsString;
Now i'm wondering how to change this code, so i could get values from two fields into one. For example i have field "firstname" and field "lastname", now i want to show this in field "name".
Example, if field firstname have value John and field lastname value is Doe, i want to show it in field name like "John Doe".
I hope that u understood what i want
Thanks for helping me!getField("Text35").value = getField("Text1").valueAsString + " " +
getField("Text2").valueAsString;
Maybe you are looking for
-
I downloaded itunes on my new laptop, but I cannot seem to find any of my content (music, movies, books...). I would like for my itunes library to be available on both computers (desktop pc and laptop pc). IS THIS POSSIBLE??? I've tried homesharing
-
BAPI_ACC_DOCUMENT_CHECK for Vendor Items
Hi friends, I am using the BAPI BAPI_ACC_DOCUMENT_CHECK to check the data to be posted for Vendor lines items. It is giving the error: 'For document type RE, an entry is required in field Reference' I have written the code like this: Loop at t_fi
-
Hi, I have senerio in which i need to call RFC through EJB. Thanks. Abhilasha Edited by: Abhilasha Dahare on Oct 3, 2008 1:29 PM
-
Travel Expense Form -- How to identify which form it is using
Hello, In PR05(Travel Expense Manager), there is a simulate button which will generate standard expense form with expense details. I ran into scenario where one user group expenseform is little different from another group employees expense form. i a
-
When printing PDF to non PS printer, text vanishes
This has happened now with a couple of PDF files that customers have sent to me. I never had this problem under Windows, but since switching to Mac it's cropped up twice. I print the PDF to my Epson C1900 and the text simply does not appear - all oth