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 PM
Hi 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
Similar Messages
-
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 -
How do I scan multiple pages into one document using the CanoScan LiDE 200?
How do I scan multiple pages into one document using the CanoScan LiDE 200?
I can't seem to find a way to get them to scan continuously, or a way to stitch them together afterwards.Hi dagda24,
You can scan multiple pages into a single document with the scan to PDF option. Use the following steps to do so:
1. Open MP Navigator.
2. Click One Clcik.
3. Click Save to PC.
4. Change the File Type from PDF to PDF (multiple pages).
5. Make any other changes as needed, then click scan.
Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well. -
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, D8hi, 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 -
Scanning multiple pages into one file using MAC
How do I scan multiple pages and save them into one file or document using a MacBook Pro laptop? My printer is an HP Photosmart 7520. When I use this printer and scan from my PC, it does allow me to scan multiple copies and save as one document by just adding pages as I scan. When I scan with my MacBook Pro, it scans each page, however, I don't get any option or choice to save as one document. It automatically saves each page as a separate document.
Try scanning from your Mac. Use Image Capture app in your Applications folder.
Click once on the scanner on the left side, then click on Show Details along the bottom. Along the right side you will see LOTS of options for scanning and saving.
One of those is Format, make the Format PDF. Just below that will be a check box allowing you to scan multiple pages to one file.
Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
I am employed by HP -
Get matrix row data and put it into header field with formatted search ???
Hi All,
I ask your help concerning the following:
On an invoice matrix I want to check all Itemgroup Codes of all items in the rows, if there are some rows' items with ItemGroupcode 101 and some others with anything else, then header field should be Y, otherwise N.
My main problem is: how do I put a matrix row data to a header data with checking all rows in the matrix?
A minor problem is that I can't get the formatted search to work on all rows when the formatted search is assigned to the user field in header.
If I put the formatted search to a row field then the row field is filled with the proper value, but the same query assigned to the user field in header works only on the first row.
What am I doing wrong?
SELECT USEDPROD= CASE T0.ItmsGrpCod WHEN 101 THEN Y ELSE N END FROM .[OITM] T0 WHERE T0.ItemCode = $[$38.1.0]
(SBO 7.6)
Any suggestions are welcome.
Thanks.
BálintDear Adele,
Thanks for the answer. The major one cannot be solved. OK, I'll try to get a workaround.
However I still do not understand why my query does not work in all selected rows, just in the first row, i.e. if I assign the query to a header field and I'm positioned in the first row it's OK, but when I add a new item to the second row or any of the next rows, the header field is not updated at all.
Why is that so? Do you have any idea?
Bálint -
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>
------------------------------------------------------------------------------------------ -------------------------- -
After inserting into one field using LOV, how to populate other fields ?
Hi,
I have a BLOCK based on a table (ex:EMP)
And I have a LOV on the field(item): EMPNO.
When I select one EMPNO from the LOV (when the field:EMPNO is populated with an emp number), the other fields should be populated
Can some body let me know, which trigger I need to use and .......
Thankswhile creating LOV at empno you can this query
select empno,ename,deptno from emp
and define return item for each column.
You can populate LOV manually at New_instance_item or Key_next_item
of item empno. -
Multiple BI Query Results into one Table
Hi All
Can I embed Multiple queries into one table using VC?
I have data in different BI sources(Info Areas) like sales and distribution,Shipments etc. Can I write any universal query to retrive data from multiple sources?(If any???)Hi Jan Pasha,
My model contains two BW queries which uses UNION and sent result to one table.
I tried using UNION also but when I use it I am able to see no records to select in result table.
I donot have any coloums in common. Is it pre-requisite for using UNION? -
How to concatenate multiple records into one
Hi everybody:
I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
Lan|Author
English|Ernest Hemingway
Spanish|Octavio Paz
Spanish|Mario Vargas Llosa
English|Sinclair Lewis
Spanish|Gabriel García Márquez
And I want to get this:
Author
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
RETURNS varchar(5000) AS
BEGIN
declare @retvalue varchar(5000)
set @retvalue=''
select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
return substring(@retvalue,1,len(@retvalue)-1)
END
ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
v_ret VARCHAR2(4000);
v_element VARCHAR2(4000);
v_cursor sys_refcursor;
BEGIN
OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
LOOP
FETCH v_cursor INTO v_elemento;
EXIT WHEN v_cursor%NOTFOUND;
IF v_ret IS NULL THEN
v_ret := v_element;
ELSE
v_ret := v_ret || ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
Exist some other way to do this?
Best Regards
JackTks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
I wil read about the other techniques than Hoek mention
Best Regards.
Jack -
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 -
Multiple rows to multiple columns on one row using SQL
Hi
I am attempting to select back multiple values for a specific key on one row. See the example below. I have been able to use the sys_connect_by_path to combine the fields into one field but I am unable to assign them to fields of their own. See the example below
TABLE DETAILS:
Policy id plan name
111 A Plan
111 B Plan
111 Z Plan
112 A Plan
112 Z Plan
My desired result is to be able to show the output as follows
Policy ID Plan_1 Plan_2 Plan_3
111 A Plan B Plan Z PLan
112 A Plan Z PLan
Can you help???Thanks for all the replies. Perhaps I could give a little more detail incldung a sample table and insert statements. The repsonses work fine but the problem I was having was that I did not want to have to hardcode in the plan_name to a decode statement. The list of plans is not exhaustive. There could be numerous different plans in the table. I have amended the details below slightly to try and give a little more information as I was probably not too clear at the start. Would you know if there is a way to do this without hardcoding the plan values in?
Thanks in advance!
CREATE TABLE TEST_SAMPLE (
POLICY_NUMBER VARCHAR2(10),
plan_name varchar2(20) );
INSERT INTO TEST_SAMPLE VALUES ('111', 'A Plan');
INSERT INTO TEST_SAMPLE VALUES ('111', 'B Plan');
INSERT INTO TEST_SAMPLE VALUES ('111', 'C Plan');
INSERT INTO TEST_SAMPLE VALUES ('112', 'J Plan');
INSERT INTO TEST_SAMPLE VALUES ('112', 'Z Plan');
My desired result is to be able to show the output as follows
Policy ID Plan_1 Plan_2 Plan_3
111 A Plan B Plan C PLan
112 J Plan Z PLan -
Concatenate multiple columns into one string
Hello,
I am using Oracle 11.2, how can I concatenate the value of multiple columns into one string with one SQL:
create table testTb(classId number(5), classRoom varchar2(32));
insert into testTb value(101, 'room101');
insert into testTb value(101, 'room201');
insert into testTb value(101, 'room301');
insert into testTb value(202, 'room444');
insert into testTb value(202, 'room555');
I would like to generate the result as followings:
Class 101 is in room101, room201, room301
Class 202 is in room444, room555
Thanks,Hi,
Since you're using Oracle 11.2, you can use the aggregate LISTAGG function:
SELECT 'Class ' || classid
|| ' is in '
|| LISTAGG ( classroom
) WITHIN GROUP (ORDER BY classroom)
AS txt
FROM testtb
GROUP BY classid
;The generic name for concatenating all the strings in a group is String Aggregation . This page shows several ways to do it, suitable for different versions of Oracle. -
I recently received a PIXMA MG7520 for a gift. It works great with my lenovo laptop/tablet running on Windos 8.0. The one drawback to the HP all-in-one that it replaced is it does not have an ADF. That being said, there must be some way to scan multiple pages into one pdf file. I need help figuring thing out. Thanks in advance!
Solved!
Go to Solution.Hi mdtolbert54,
There is a program that comes with the printer called the IJ Scan Utility that can assist you with scanning multiple pages into a single PDF document. To do this, please follow these steps:
1. On your keyboard, press the Windows key.
2. Start typing IJ SCAN UTILITY. The search window opens as you type. Once the IJ SCAN UTILITY is displayed, please select and open it.
3. In the Canon IJ Scan Utility window that opens, click SETTINGS.... in the bottom right of the window. The Settings dialog box appears.
4. Click the DOCUMENT SCAN option on the left pane of the window.
5. In the SAVE SETTINGS section of the window, you will select the save format and location of the document you are about to scan.
a.) In the FILE NAME field, specify the name you would like to give the file. By default the filename will begin with IMG; you can remove IMG and change it to whatever you would like to name the file.
b.) In the DATA FORMAT field, use the drop-down arrow to select the PDF (Multiple Pages) option.
c.) In the SAVE IN field, please navigate to the area where you would like the file to be saved once it is scanned in. By default, the file will be saved in the MY DOCUMENTS folder.
6. Once all settings have been selected, click the OK button at the bottom of the window to save the changes. The IJ Scan Utility main screen appears.
7. Click the DOCUMENT button. Scanning starts. Click the CANCEL button to cancel scanning if needed. Scanned items are saved in previously selected folder location specified in the SETTINGS... window.
If you find that you need advanced scanning options such as adjusting resolution, brightness, contrast, saturation, color balance, etc. in addition to the options selected above, please click on the SCANGEAR button on the IJ Scan Utility Main screen, then adjust the items as necessary.
Once the items above are set for document scanning, in the future, you will only need to launch the IJ Scan Utility, then press the DOCUMENT button to perform the scan (unless you want to make changes to the settings).
Hope this helps!
This didn't answer your question or issue? Please call or email us using one of the methods on the Contact Us page for further assistance.
Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well. -
Need to concat multiple elements into one element
Hello, here is my challenge:
Query:
SELECT XMLROOT (
XMLELEMENT ("Inv",
XMLAGG (
XMLELEMENT ("Invline",
XMLELEMENT ( "Category", i.category ),
XMLELEMENT ( "Amount", i.amount ),
), VERSION '1.0', STANDALONE YES).EXTRACT ('/*')
FROM (
SELECT 1 AS inv_no, 'Labor' AS category, 5 AS amount FROM DUAL
UNION ALL
SELECT 1, 'Out-of-Pocket', 10 FROM DUAL
UNION ALL
SELECT 1, 'Travel', 20 FROM DUAL
UNION ALL
SELECT 1, 'Travel', 2.5 FROM DUAL) i;
Returns:
<?xml version="1.0" standalone="yes"?>
<Inv>
<Invline>
<Category>Labor</Category>
<Amount>5</Amount>
</Invline>
<Invline>
<Category>Out-of-Pocket</Category>
<Amount>10</Amount>
</Invline>
<Invline>
<Category>Travel</Category>
<Amount>20</Amount>
</Invline>
<Invline>
<Category>Travel</Category>
<Amount>2.5</Amount>
</Invline>
</Inv>
Required:
<?xml version="1.0" standalone="yes"?>
<Inv>
<Inv_No>1
<Details>Labor 5
Out-of-Pocket 10
Travel 22.5
</Details>
</Inv_no>
</Inv>
So I would like help combining the details into one field for transmission to the Mexican Tax Authorities( their spec calls for all invoice lines to be concated together).
Note that there are two travel details that need to be summed as well.
I would prefer to cannot change the query if possible, just using the XML functions.
Thanks!And your db version is?
From 11.2 and onwards, you can use LISTAGG aggregate function to concatenate character data across rows :
SELECT XMLElement("Inv"
, XMLAgg(
XMLElement("Inv_No"
, v.inv_no
, XMLElement("Details"
, listagg(v.category || ' ' || to_char(v.amount), chr(10))
within group (order by v.category)
FROM(
SELECT t.inv_no
, t.category
, sum(t.amount) as amount
FROM (
SELECT 1 AS inv_no, 'Labor' AS category, 5 AS amount FROM DUAL UNION ALL
SELECT 1, 'Out-of-Pocket', 10 FROM DUAL UNION ALL
SELECT 1, 'Travel', 20 FROM DUAL UNION ALL
SELECT 1, 'Travel', 2.5 FROM DUAL
) t
GROUP BY t.inv_no, t.category
) v
GROUP BY v.inv_no ;
Maybe you are looking for
-
New Gl 0Fi_GL_14 and impact on existing _4 AP and AR datasources
We will be moving to new GL and I'm investiagting the 0FI_GL_14 Datasource for this purpose.I have couple of questions on this datasource. I couldn't find any related AP and AR datasources for new GL. Does this mean we can continue to use 0FI_AP_4 a
-
How can I distort footage in AME?
I have PAL footage @ 720x576px with a 16:9 flag for aspect ratio. I want to encode this to a H264 file at 720x576px square pixel, discarding the aspect ration. Currently AME is scaling (letterboxing) my footage into 720x576 preserving the aspect rati
-
Report For Incoming Check Receipts
Hello All, Was wondering if anyone is familiar with the report listing all your manual incoming check payments. I know for outgoing payments the standard report is S_ALR_87012104 and would like a similar report only now for incoming manual checks tha
-
Best accessories for uMBP -- Cleaning and Protecting
Hey guys, Just wondering what you guys use to clean your uMBP -- I've been using iKlear with the cloth they give us and I have no problem with that. Is there anything else that you guys use to clean the keys and casing? I only use the iKlear to clean
-
ZLM 7.3 and ZCM 10.2
Can these two products be installed onto the same machine? I am working with XEN Virtual machines and I would like to be able to install the ZCM and the ZLM onto the same machines and I would like to know if anyone has tried this, or knows if it can