Concatenating rows of a table into a single string
Hi,
My report gets an internal table LINES from READ_TEXT function module. This internal table LINES has 6 rows. My requirement is to concatenate all the 6 rows into a single field of string.
This is wht i have done.
data str type string.
loop at lines.
concatenate str lines into str separated by space.
clear lines.
endloop.
this code concatenates first three rows of the internal table LINES into STR, however the next rows are not concatenated into STR.
I have tried using
data : str(4096) type c.
but still it doesnt work.
Please advise.
Many Thanks,
Pritish.
dont worry, the values will never get truncated.
have a look at this code.
REPORT ZSTRINGSTRANGE line-size 1023 .
data : lines type TLINE occurs 0 with header line.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
lines-tdformat = '*'.
lines-tdline = 'This is line 1, This is line 2, This is line 3'.
append lines.
data str type string.
loop at lines.
concatenate str lines into str separated by space.
clear lines.
endloop.
write: / str.
Similar Messages
-
Numbers: Copy/Paste from multiple tables into 1 single Table?
I would appreciate some guidance in creating a copy/paste script from multiple numbers tables into a different single table within the same numbers document.
The columns in the source table are in different positions to the destination table.
So for example, i would want to copy…
Sheet 1, Table 1 Cell A3 copy to Sheet 2 Table Z Cell B2
Sheet 1, Table 1 Cell B3 copy to Sheet 2 Table Z Cell C2
Sheet 1, Table 1 Cell C3 copy to Sheet 2 Table Z Cell E2
Sheet 1, Table 1 Cell D3 copy to Sheet 2 Table Z Cell F2
Sheet 1, Table 1 Cell E3 copy to Sheet 2 Table Z Cell G2
Sheet 1, Table 1 Cell G3 copy to Sheet 2 Table Z Cell I2
Sheet 1, Table 1 Cell J3 copy to Sheet 2 Table Z Cell H2
and repeat the copy/paste on subsequent rows of each table until there is an empty row in Sheet 1 Table 1 (or if this is difficult, say set the repeat to a max of 30 rows).
The script would then need to move on to Sheet 1 Table 2, and do the same copying to Sheet 2 Table Z (from where the previous copy/paste finished in Table Z).
Repeat process would finalise with Sheet 1 Table 6.
The Paste part would need to be pasting values, as the cells in the source tables do contain some formulas.
At the moment this is all done manually and does take some to to undertake.
If anyone can help, i would be very grateful.
Thanks,
ColinInterceptor,
are you trying to aggregate data from severl tables into a single table? If so you whould be able to do this without a script. The function indirect() will allow you to construct the proper formula, which you may fill over (in the same row) to the appropriate cells, then fill down.
Here is a small example:
There are three data tables ("Table 1", "Table 2", and "Table 3"). And a summary "Table Z"
In table Z make the first row a header (as shown):
Use column A to enter the Sheet name and colomn B to enter the table name.
In row 1 (the header), enter the cells you want to get
in cell C2 type (or copy and paste from here) the formula:
=INDIRECT($A2&"::"&$B2&"::"&C$1)
now select cell C2, copy now select cell C2 thru H2, paste
now select the cells C2 thu H2, hover the corsor over the bottom edge of the selection, and drag the yellow cirlc down as needed to fill the formula down.
Update the sheet and table names as needed for each row -
Export Multiple tables into a single Excel Sheet
We have a use case where we need to export multiple tables into an excel sheet. The exportCollectionActionListener only allows one table (which is provided in the exportedId attribute) to be exported into Excel. So is there a method provided by adf to export more that one table into excel ?
dvohra,
I need to export multiple tables into a single excel sheet. These links only show how to export a single table to an excel sheet.
I have tried out this : http://iadvise.blogspot.com/2007/04/export-adf-table-to-excel.html. But i am not getting the popup to save the file. So i can't find out where the file got created. -
How to bring the more than one rows from the table into the script
Hi
I have to bring more than one rows from the table into the Main windows of the script. so plz help me out.
Thanks in Advance
AnanyaHi Ananya,
Bring more than one row into main window of script.
For this you need to do some changes for data which you pass to main window.At a time you need to pass more than one row,so for this you need to define one structure.See below code.
Types:begin of ty_rows,
include structure (your row_structure),
include structure (your row_sturcture),
Types:end of ty_rows.
for example....
If i need to pass 2 vendor details at a time to main window then the structure should be like this.
Types:begin of ty_rows,
vendor1 like lfa1-lifnr,
vendor1_name like lfa1-name1,
vendor2 like lfa1-lifnr,
vendor2_name like lfa1-name1,
end of ty_rows.
Data:i_main type standard table of ty_rows,
wa_main type ty_rows.
Based on condition you can pass more than one rows of your actual internal table data to i_main internal table.
Then you can pass i_main internal table to your main window.
I think this will help you.
Cheers,
Bujji -
Convert an array of strings into a single string
Hi
I am having trouble trying to figure out how to convert an array of strings into a single string.
I am taking serial data via serial read in a loop to improve data transfer. This means I am taking the data in chunks and these chunks are being dumped into an array. However I want to combine all elements in the array into a single string (should be easy but I can't seem to make it work).
In addition to this I would also like to then split the string by the comma separator so if any advice could be given on this it would be much appreciated.
Many Thanks
Ashley.Well, you don't even need to create the intermediary string array, right? This does exactly the same as CCs attachment:
Back to your serial code:
Why don't you built the array at the loop boundary? Same result.
You could even built the string directly as shown here.
Message Edited by altenbach on 12-20-2005 09:39 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
autoindexing.png 5 KB
concatenate.png 5 KB
StringToU32Array.png 3 KB -
Extract Multiple Rows from a Single Table into a Single Row in a New Table
I have a table in a database that contains contact data like name, address, phone number, etc.
The folks who designed the database and wrote the application wrote it so that all contact records are placed in that table, regardless of contact type. In fact, the contacts table does not even have a column for "type" even though there are many
different types of contacts present in that table.
I am trying to write a mail merge style report in SRSS, that gets sent to a specific type of contact, based on criteria provided that must be obtained from another table, and that data is then used to get back to a specific set of contacts from the contacts
table.
The attached file directly below describes my problem and all related information in an extremely detailed way.
SRSSMailMergeIssue.pdf
Unless there is a way to make a SRSS Tablix point to two different data sets in SRSS, it looks like I have to combine multiple rows from the same table into a new table.
If anyone can review the details in the attached pdf file and possibly point me in the direction I need to run to solve this probelm, I would greatly appreciate it.
I also included a document (below) that shows the tables I reference in the probelm description.
dbtables.pdfI found a solution.... and posted it below
select
dk.ucm_docketnumber [UCM DocketNumber],
dk.ucm_docketid [UCM DocketID],
vc.FirstName [Victim FirstName],
vc.MiddleName [Victim MiddleName],
vc.LastName [Victim LastName],
vc.Suffix [Victim Suffix],
vc.Address1_Line1 [Victim AddressLine1],
vc.Address1_Line2 [Victim AddressLine2],
vc.Address1_Line3 [Victim AddressLine3],
vc.Address1_City [Victim City],
vc.Address1_StateOrProvince [Victim StateProvince],
vc.Address1_PostalCode [Victim Postalcode],
oc.FirstName [Offender FirstName],
oc.MiddleName [Offender MiddleName],
oc.LastName [Offender LastName],
oc.Suffix [Offender Suffix],
oc.Address1_Line1 [Offender AddressLine1],
oc.Address1_Line2 [Offender AddressLine2],
oc.Address1_Line3 [Offender AddressLine3],
oc.Address1_City [Offender City],
oc.Address1_StateOrProvince [Offender StateProvince],
oc.Address1_PostalCode [Offender Postalcode],
pc.FirstName [Arresting Officer FirstName],
pc.MiddleName [Arresting Officer MiddleName],
pc.LastName [Arresting Officer LastName],
pc.Address1_Line1 [Arresting Officer AddressLine1],
pc.Address1_Line2 [Arresting Officer AddressLine2],
pc.Address1_Line3 [Arresting Officer AddressLine3],
pc.Address1_City [Arresting Officer City],
pc.Address1_StateOrProvince [Arresting Officer StateProvince],
pc.Address1_PostalCode [Arresting Officer Postalcode]
FROM ucm_docket dk
left outer join ucm_victim v on dk.ucm_docketid = v.ucm_docketnumber
left outer join contact vc on vc.contactid = v.ucm_victimlookup
left outer join ucm_offender o on o.ucm_offenderid = dk.ucm_offenderlookup
left outer join contact oc on oc.contactid = o.ucm_individualid
left outer join contact pc on pc.contactid = dk.ucm_ArrestingOfficerLookup
WHERE (dk.ucm_docketnumber = @DocketNUM) -
Need help with query joining several tables into a single return line
what i have:
tableA:
puid, task
id0, task0
id1, task1
id2, task2
tableB:
puid, seq, state
id0, 0, foo
id0, 1, bar
id0, 2, me
id1, 0, foo
id2, 0, foo
id2, 1, bar
tableC:
puid, seq, date
id0, 0, 12/21
id0, 1, 12/22
id0, 2, 12/22
id1, 0, 12/23
id2, 0, 12/22
id2, 1, 12/23
what i'd like to return:
id0, task0, 12/21, 12/22, 12/22
id1, task1, 12/23, N/A, N/A
id2, task2, 12/22, 12/23, N/A
N/A doesn't mean return the string "N/A"... it just means there was no value, so we don't need anything in this column (null?)
i can get output like below through several joins, however i was hoping to condense each "id" into a single line...
id0, task0, 12/21
id0, task0, 12/22
id0, task0, 12/23
id1, task1, 12/23
is this possible fairly easily?
Edited by: user9979830 on Mar 29, 2011 10:53 AM
Edited by: user9979830 on Mar 29, 2011 10:58 AMHi,
Welcome to the forum!
user9979830 wrote:
what i have:...Thanks for posting that so clearly!
Whenever you have a question, it's even better if you post CREATE TABLE and INSERT statements for your sample data, like this:
CREATE TABLE tablea
( puid VARCHAR2 (5)
, task VARCHAR2 (5)
INSERT INTO tablea (puid, task) VALUES ('id0', 'task0');
INSERT INTO tablea (puid, task) VALUES ('id1', 'task1');
INSERT INTO tablea (puid, task) VALUES ('id2', 'task2');
CREATE TABLE tablec
( puid VARCHAR2 (5)
, seq NUMBER (3)
, dt DATE -- DATE is not a good column name
INSERT INTO tablec (puid, seq, dt) VALUES ('id0', 0, DATE '2010-12-21');
INSERT INTO tablec (puid, seq, dt) VALUES ('id0', 1, DATE '2010-12-22');
INSERT INTO tablec (puid, seq, dt) VALUES ('id0', 2, DATE '2010-12-22');
INSERT INTO tablec (puid, seq, dt) VALUES ('id1', 0, DATE '2010-12-23');
INSERT INTO tablec (puid, seq, dt) VALUES ('id2', 0, DATE '2010-12-22');
INSERT INTO tablec (puid, seq, dt) VALUES ('id2', 1, DATE '2010-12-23');This way, people can re-create the problem and test their ideas.
It doesn't look like tableb plays any role in this problem, so I didn't post it.
Explain how you get the results from that data. For example, why do you want this row in the results:
PUID TASK DT1 DT2 DT3
id0 task0 12/21/2010 12/22/2010 12/22/2010rather than, say
PUID TASK DT1 DT2 DT3
id0 task0 12/22/2010 12/21/2010 12/22/2010? Does 12/21 have to go in the first column because it is the earliest date, or is it because 12/21 is related to the lowest seq value? Or do you even care about the order, just as long as all 3 dates are shown?
Always say what version of Oracle you're uisng. The query below will work in Oracle 9 (and up), but starting in Oracle 11, the SELECT ... PIVOT feature could help you.
i can get output like below through several joins, however i was hoping to condense each "id" into a single line... Condensing the output, so that there's only one line for each puid, sounds like a job for "GROUP BY puid":
WITH got_r_num AS
SELECT puid
, dt
, ROW_NUMBER () OVER ( PARTITION BY puid
ORDER BY seq -- and/or dt
) AS r_num
FROM tablec
-- WHERE ... -- If you need any filtering, put it here
SELECT a.puid
, a.task
, MIN (CASE WHEN r.r_num = 1 THEN r.dt END) AS dt1
, MIN (CASE WHEN r.r_num = 2 THEN r.dt END) AS dt2
, MIN (CASE WHEN r.r_num = 3 THEN r.dt END) AS dt3
, MIN (CASE WHEN r.r_num = 4 THEN r.dt END) AS dt4
FROM tablea a
JOIN got_r_num r ON a.puid = r.puid
GROUP BY a.puid
, a.task
ORDER BY a.puid
;I'm guessing that you want the dates arranged by seq; that is, for each puid, the date related to the lowest seq comes first, regardless of whther that date is the earliest date for that puid or not. If that's not what you need, then change the analytic ORDER BY clause.
This does not assume that the seq values are always consecutive integers (0, 1, 2, ...) for each puid. You can skip, or even duplicate values. However, if the values are always consecutive integers, starting from 0, then you could simplify this. You won't need a sub-query at all; just use seq instead of r_num in the main query.
Here's the output I got from the query above:
PUID TASK DT1 DT2 DT3 DT4
id0 task0 12/21/2010 12/22/2010 12/22/2010
id1 task1 12/23/2010
id2 task2 12/22/2010 12/23/2010As posted, the query will display the first 4 dts for each puid.
If there are fewer than 4 dts for a puid, the query will still work. It will leave some columns NULL at the end.
If there are more than 4 dts for a puid, the query will still work. It will display the first 4, and ignore the others.
There's nothing special about the number 4; you could make it 3, or 5, or 35, but whatever number you choose, you have to hard-code that many columns into the query, and always get that many columns of output.
For various ways to deal with a variable number of pivoted coolumns, see the following thread:
PL/SQL
This question actually doesn't have anything to do with SQL*Plus; it's strictly a SQL question, and SQL questions are best posted on the "SQL and PL/SQL" forum:
PL/SQL
If you're not sure whether a question is more of a SQL question or a SQL*Plus question, then post it on the SQL forum. Many more people pay attention to that forum than to this one. -
I need help figuring out how to take data from internet pages and enter it into one single row in an excel, or numbers if that is the easier way to go. I was also told access might be good to use. Basically I am going to chamber of commerce page and wanting to extract the member listing and enter in a database in a single line. The data is in different numbers of lines as you will see below (info edited to take out personal info). So I want to take the name of business, business owner, address, city, state, zip, and phone and put it into one line on a spreadsheet. I want to do this many times over. I think there is a way to do it through apple script and automator, but I have not been successful after 2 weeks of trying and searching. I have over 800 listings and I surely don't want to go through and do them one at a time. Any suggestions?
Data from website:
Westrock Coffee
Mr.
Collins Industrial Place
North Little Rock, AR 72113
Phone:
Send Email
Member Since: 2011
Sweet Creations by DJ
Ms. J
allace Bridge Road
Perryville, AR 72126
Phone:
Fax:
Send Email
Member Since: 2013
See Also Woman Owned and/or CEO
Premium Refreshment Service
Mr. E
est Bethany Road
North , AR 72117
I want it to look like this
Company name, owner name, address, city, state, zip, phone
How can I get the extra data out of the way and remove the format so that it will go into excel? Thanks for any help you can provide. I am not to savvy with code, but I got a friend who is an IT guy that can help. Thanks againSo, basically, create 800 individual entries, each one containing everything from business name through the phone (not fax) number, add some commas and spaces to entries, and then put each entry on a separate line?
1. Go to website page such as this one-- http://www.littlerockchamber.com/CWT/External/WCPages/WCDirectory/Directory.aspx ?ACTION=newmembers --which seems formatwise very close to what you're trying to scrape.
2. Cmd-A to select all. Cmd-C to copy it to clipboard.
3. Open freeware TextWrangler. Cmd-V to paste info from clipboard into a blank TW document.
4. Remove lines from top and bottom so that only membership list remains.
5. Process lines to remove everything from "Fax" line through "See Also" line. Only business name through phone number will remain in the file.
--A. TW > Text > Process Lines containing . . .
-----(check "Delete matched lines"; uncheck all others)
-----Enter "Send Email" in the search box.
-----Click Process.
--B. Repeat 5A for other lines to be removed
------Member Since
------See Also
------Fax
6. Insert markers to separate entries:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: \r\r\r\r
------in replace box: \r***
------Click Replace All
7. Remove remaining blank lines:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: \r\r
------in replace box: \r
------Click Replace All
8. Add comma and space at end of each line:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: $
------in replace box: , (comma space)
------Click Replace All
9. Remove all returns:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: \r
------in replace box: (leave blank)
------Click Replace All
10. Insert returns in place of markers:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: \*\*\*, (backslash asterisk backslash asterisk backslash asterisk comma space)
------in replace box: \r
------Click Replace All
11. Remove trailing comma and blank on each line:
TW: Search > Find . . .
------(check "Wrap around" and "Grep")
------in Find box: , $ (comma space dollar sign)
------in replace box: (leave blank)
------Click Replace All
Import this text file into Excel or Numbers. -
Inserting rows in 2 tables using a single query
Can we insert values in two tables using a single INSERT query?
Yes we can insert data in multiple tables using (Multiple insert statement (oracle 9i New Feature))in a single statement.
ex:
INSERT ALL
INTO sal_history VALUES(empid,hiredate,sal)
INTO mgr_history VALUES(empid,mgr,sysdate)
SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGR
FROM employees;
sncr
Naresh -
Combine 2 internal tables into a single internal table
Hi
I need to replace the following join statement by splitting it into 2 select statements and then combine them into a single internal table
SELECT vbak~waerk
vbapvbeln vbapposnr vbapnetwr vbapbrgew
vbap~erdat "IM152805
INTO CORRESPONDING FIELDS OF TABLE l_t_orders
FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
FOR ALL entries IN t_mchb
WHERE vbap~vbeln = t_mchb-vbeln
AND vbap~posnr = t_mchb-posnr.
Need to replace the above with separate select statements and then combine the result into a single internal table...
could anyone please help me...
thanks in advanceHi,
Check the code below,
select vbeln waerk
from vbak into table it_vbak for all entries in t_mchb where vbeln = t_mchb-vbeln.
select posnr
netwr
brgew
erdat "IM152805
INTO TABLE it_vbap
for all entries in t_mchb
where vbeln = t_mchb-vbeln
and posnr = t_mchb-posnr.
loop at it_vbap into wa_vbap.
read table it_vbak into wa_vbak where vbeln = wa_vbap-vbeln.
if sy-subrc = 0.
l_t_orders-waerk = wa_vbak-waerk.
l_t_orders-vbeln = wa_vbap-vbeln.
l_t_orders-posnr = wa_vbap-posnr
l_t_orders-netwr = wa_vbap-netwr.
l_t_orders-brgew = wa_vbap-brgew.
l_t_orders-erdat = wa_vbap-erdat.
append l_t_orders.
endif.
endloop.
Reward if it is helpful.
Regards,
Bhanu -
Combine 2 Queries (from SAME table) into a SINGLE query
I have this two queries (from SAME table), and want to combine into one SINGLE query, how?
How can we use CASE WHEN THEN for such situation?
Query1:
SELECT t_inner.*,
Floor(t_inner.ProductiveTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.ProductiveTime,3600) / 60),2,0) || 'min:' AS Productive_Time,
Floor(t_inner.OperatorDownTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.OperatorDownTime,3600) / 60),2,0) || 'min:' AS OperatorDown_Time
FROM
(SELECT SYSTEMTYPE,
sum(TIME_TEST + TIME_STEP) AS ProductiveTime,
sum(TIME_IDLE) AS OperatorDownTime
FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
WHERE (SYSTEMTYPE = '0005-072')
AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
AND MONO != '9999999999'
GROUP BY SYSTEMTYPE ) t_inner
Query 2:
SELECT t_inner.*,
Floor(t_inner.MachineDownTime/ 3600) || 'hr ' || LPAD(Floor(Mod(t_inner.MachineDownTime,3600) / 60),2,0) || 'min' AS MachineDown_Time
FROM
(SELECT SYSTEMTYPE,
sum(TIME_IDLE) AS MachineDownTime
FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
WHERE (SYSTEMTYPE = '0005-072')
AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
AND MONO = '9999999999'
GROUP BY SYSTEMTYPE) t_inner
see http://postimg.org/image/koq87iyyz/ and
http://postimg.org/image/fv3zxa38nwith the first query,
SELECT t_inner.*,
Floor(t_inner.ProductiveTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.ProductiveTime,3600) / 60),2,0) || 'min' AS Productive_Time
FROM
(SELECT SYSTEMTYPE,
--sum(TIME_TEST) AS TIME_TEST,
--sum(TIME_SYSTEM) AS TIME_SYSTEM,
--sum(TIME_STEP) AS TIME_STEP,
--sum(TIME_IDLE) AS TIME_IDLE,
sum(TIME_TEST + TIME_STEP) AS ProductiveTime
FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
WHERE (SYSTEMTYPE = '0005-072')
AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
AND MONO != '9999999999'
GROUP BY SYSTEMTYPE) t_inner
it gives output as from
http://postimg.org/image/koq87iyyz/
with the second query,
SELECT t_inner.*,
Floor(t_inner.MachineDownTime/ 3600) || 'hr ' || LPAD(Floor(Mod(t_inner.MachineDownTime,3600) / 60),2,0) || 'min' AS MachineDown_Time
FROM
(SELECT SYSTEMTYPE,
sum(TIME_IDLE) AS MachineDownTime
FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
WHERE (SYSTEMTYPE = '0005-072')
AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
AND MONO = '9999999999'
GROUP BY SYSTEMTYPE) t_inner
it gives output as from
http://postimg.org/image/fv3zxa38n/
I want to come those 2 queries into a single query, such that it gives both outputs as above. Let me know if you need any other information. thanks. -
How to save the selected rows from Advance table into database
Hi
I have requirement like..
In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
The reqt is how to save the selected multiple rows into the database.hi Reetesh,
In Custom page
Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
So in Such scenario how to save this 10 rows against Recruiter
, i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
I hope u understand my question -
Concatenate fields on multiple child rows into one single string
Hi -
I'm pretty much new to BI Publisher, and I looked through the forums for what I was trying to do below, but couldn't find much on this.
Here's my data source:
<BUSINESSES>
<BUSINESS>
<NAME>Microsoft</NAME>
</BUSINESS>
<BUSINESS>
<NAME>Apple</NAME>
</BUSINESS>
<BUSINESS>
<NAME>Google</NAME>
</BUSINESS>
<BUSINESS>
<NAME>Yahoo</NAME>
</BUSINESS>
</BUSINESSES>
What I was trying to do is create a single string from the XML data source in the form
Microsoft,Apple,Google,Yahoo,............
Here was my plan to do this:
1. Create a global variable - <?variable:AllNames;''?>
2. Loop - For each BUSINESS
2a. Capture NAME - <?variable@incontext:BusName;'NAME'?>
2b. Concatenate it to the global variable AllNames - <?variable:AllNames;concat($AllNames,',',$BusName)?>
3. End Loop
4. Display global variable - <?$AllNames?>
I get a blank RTF when I run this.
Can someone please advice me on this? I thought it would be pretty simple to do, but here i am at the end of the day, and ...
Thank you.There are multiple ways to do it..
one option of using variable, which i would not certainly do is this :)
<?xdoxslt:set_variable($_XDOCTX,'TESTTEST’,’’)?>
<?for-each:/BUSINESSES/BUSINESS?>
<?position()?>: <?NAME?> <?xdoxslt:set_variable($_XDOCTX,'TESTTEST’, concat(xdoxslt:get_variable($_XDOCTX,'TESTTEST’),’,’ ,NAME) )?>
<?end for-each?>
<?xdoxslt:get_variable($_XDOCTX,'TESTTEST’)?> -
Concatenating numbers with leading zeros into a global string in DasyLab
I need to format a global variable into a global string with the field width exactly three characters long. For example, if the global variable is 1, the global string needs to be "001". I tried using strfmt(${VAR_801},3,0) as the expression under the extended global string dialog, but that results in "1". Any help or suggestions are appreciated.
Hello Mark,
DasyLab support is handled through the following website.
DASYLab
www.dasylab.net
Regards,
Todd D.
NI Applications Engineer -
How to combine large number of key-value pair tables into a single table?
I have 250+ key-value pair tables with the following characteristics
1) keys are unique within a table but may or may not be unique across tables
2) each table has about 2 million rows
What is the best way to create a single table with all the unique key-values from all these tables? The following two queries work till about 150+ tables
with
t1 as ( select 1 as key, 'a1' as val from dual union all
select 2 as key, 'a1' as val from dual union all
select 3 as key, 'a2' as val from dual )
, t2 as ( select 2 as key, 'b1' as val from dual union all
select 3 as key, 'b2' as val from dual union all
select 4 as key, 'b3' as val from dual )
, t3 as ( select 1 as key, 'c1' as val from dual union all
select 3 as key, 'c1' as val from dual union all
select 5 as key, 'c2' as val from dual )
select coalesce(t1.key, t2.key, t3.key) as key
, max(t1.val) as val1
, max(t2.val) as val2
, max(t3.val) as val3
from t1
full join t2 on ( t1.key = t2.key )
full join t3 on ( t2.key = t3.key )
group by coalesce(t1.key, t2.key, t3.key)
with
master as ( select rownum as key from dual connect by level <= 5 )
, t1 as ( select 1 as key, 'a1' as val from dual union all
select 2 as key, 'a1' as val from dual union all
select 3 as key, 'a2' as val from dual )
, t2 as ( select 2 as key, 'b1' as val from dual union all
select 3 as key, 'b2' as val from dual union all
select 4 as key, 'b3' as val from dual )
, t3 as ( select 1 as key, 'c1' as val from dual union all
select 3 as key, 'c1' as val from dual union all
select 5 as key, 'c2' as val from dual )
select m.key as key
, t1.val as val1
, t2.val as val2
, t3.val as val3
from master m
left join t1 on ( t1.key = m.key )
left join t2 on ( t2.key = m.key )
left join t3 on ( t3.key = m.key )
/A couple of questions, then a possible solution.
Why on earth do you have 250+ key-value pair tables?
Why on earth do you want to consolodate them into one table with one row per key?
You could do a pivot of all of the tables, without joining. something like:
with
t1 as ( select 1 as key, 'a1' as val from dual union all
select 2 as key, 'a1' as val from dual union all
select 3 as key, 'a2' as val from dual )
, t2 as ( select 2 as key, 'b1' as val from dual union all
select 3 as key, 'b2' as val from dual union all
select 4 as key, 'b3' as val from dual )
, t3 as ( select 1 as key, 'c1' as val from dual union all
select 3 as key, 'c1' as val from dual union all
select 5 as key, 'c2' as val from dual )
select key, max(t1val), max(t2val), max(t3val)
FROM (select key, val t1val, null t2val, null t3val
from t1
union all
select key, null, val, null
from t2
union all
select key, null, null, val
from t3)
group by keyIf you can do this in a single query, unioning all 250+ tables, then you do not need to worry about chaining or migration. It might be necessary to do it in a couple of passes, depending on the resources available on your server. If so, I would be inclined to create the table first, with a larger than normal percent free, then do the first set as a straight insert, and the remaining pass or passes as a merge.
Another alternative might be to use the approach above, but limit the range of keys in each pass. So pass one would have a predicate like where key between 1 and 10 in each branch of the union, pass 2 would have key between 11 and 20 etc. That way everything would be straight inserts.
Having said all that, I go back to my second question above, why on earth do you want/need to do this? What is the business requirement you are trying to solve. There might be a much better way to meet the requirement.
John
Maybe you are looking for
-
How to share calendar on all devices
I just purchased a new iPad and only some calendar events have transferred over. Checked all my settings and everything looks fine. Not sure where to look from here. I also have an iPhone and Mini iPad that are working fine with the shared calendar.
-
Organizer working-Editor not working
After install the Orgainzer works but the Photo Editor doesn't. When I click the Photo Editor in the splash screen it tells me my trial period is up. I'm using Windows Vista Home Basic 32 bit
-
Problem saving data model when using Oracle DB Pivot feature
I have problem saving a data model - SQL Query that uses the Oracle DB PIVOT feature? When I hit save, nothing happends.... have also tried "save as" - nothing is saved No error message is shown. Is Oracle DB PIVOT not supported by OBIEE? The SQL tha
-
Hi, I have to upload data in IT0009 including IBAN. As per the requirement I have to update IBAN first and then upload the record in IT0009. I have to update IBAN against Country,Bank Account, Bank Key, Control Key. I have used the following functio
-
Hi All, The messages are stuck up in queue ,if we check in queue the STATUS is *_connection closed and no data _