Separate addresses into different columns in numbers
I am migrating some customer data from Front Desk into Infusionsoft. Front Desk has exported the addresses into a single column but I need the addresses separated into 4 separate columns: Street Address, City, State, Zip Code. How can I accomplish this?
I see the problem. That's not so easy because the addresses are not uniform. Some have a comma between address and city, and some have a linefeed.
If you are using Numbers 3 then the script below should help. To use it:
Copy-paste the script into Script Editor (in Applications > Utilities)
Select the cells in the column with the addresses you want to split
With the cells selected click the "run" button in Script Editor, and wait for the notification to paste.
Click once in the top-left cell of the range where you want to paste the values.
Type command-v to paste.
If all goes well, you should get something like this:
If you have zip codes with leading zeros, first format that column as text before pasting the results from the script.
It's better to not have blank rows in the middle of the data, but the script may be able to handle that gracefully.
If you have problems, post a screenshot of results and some adjustments to the script should do the trick. This works in Numbers 3. If you're still using Numbers 2, then the script will need modification.
SG
tell application "Numbers"
tell document 1's active sheet
tell (first table whose selection range's class is range)
tell selection range
set pasteStr to ""
repeat with c in cells
set v to c's value
set pasteStr to pasteStr & my parseAddress(v)
end repeat
end tell
end tell
end tell
end tell
set the clipboard to pasteStr
display notification "Click a cell once and command-v to paste"
to parseAddress(s)
try
set zip to s's word -1 -- last "word"
set state to s's word -2 -- second to last word
set AppleScript's text item delimiters to {",", linefeed}
set sParts to s's text items
if sParts's length = 3 then
set street to sParts's item 1
set city to sParts's item 2
else
set street to sParts's item 1 & " " & sParts's item 2
set city to sParts's item 3
end if
set AppleScript's text item delimiters to ""
return street & tab & city & tab & state & tab & zip & return
on error
return return -- a "blank" for that line
end try
end parseAddress
Similar Messages
-
Breaking the string into different columns
Hi Guys,
I need to break the following string into different columns
'XXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007.'
I am trying to write it using instr and substr , but having some issues .
Is there any other way to do this. If not can someone help me , below is the query that i am working on
SELECT SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', 1, INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) - 1) col1,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1, 2)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1)
- 1
) col2,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 1)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2)
- 1
) col3
from dual
It is very urgent.
Thanks in advance.npejavar wrote:
It is very urgent.
It doesn't look urgent, you could simply read the manuals for instr and substr or describe any issues or errors you are having, or post sample data so people could help you more easily, or format your code so it is more readable, but you don't bother to do any of those things so if it isn't important to you to extend any effort, why would it be important to us?
If it was really urgent it would be a violation of the conditions of use of these forums.
http://www.catb.org/esr/faqs/smart-questions.html#urgent
http://www.oracle.com/html/terms.html
>
4. Use of Community Services
Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle -
How to parse a delimited string and insert into different columns?
Hi Experts,
I need to parse a delimited string ':level1_value:level2_value:level3_value:...' to 'level1_value', 'level2_value', etc., and insert them into different columns of one table as one row:
Table_Level (Level1, Level2, Level3, ...)
I know I can use substr and instr to get level value one by one and insert into Table, but I'm wondering if there's better ways to do it?
Thanks!user9954260 wrote:
However, there is one tiny problem - the delimiter from the source system is a '|' When I replace your test query with | as delimiter instead of the : it fails. Interestingly, if I use ; it works. See below:
with t as (
select 'str1|str2|str3||str5|str6' x from dual union all
select '|str2|str3|str4|str5|str6' from dual union all
select 'str1|str2|str3|str4|str5|' from dual union all
select 'str1|str2|||str5|str6' from dual)
select x,
regexp_replace(x,'^([^|]*).*$','\1') y1,
regexp_replace(x,'^[^|]*|([^|]*).*$','\1') y2,
regexp_replace(x,'^([^|]*|){2}([^|]*).*$','\2') y3,
regexp_replace(x,'^([^|]*|){3}([^|]*).*$','\2') y4,
regexp_replace(x,'^([^|]*|){4}([^|]*).*$','\2') y5,
regexp_replace(x,'^([^|]*|){5}([^|]*).*$','\2') y6
from t;
The "bar" or "pipe" symbol is a special character, also called a metacharacter.
If you want to use it as a literal in a regular expression, you will need to escape it with a backslash character (\).
Here's the solution -
test@ORA11G>
test@ORA11G> --
test@ORA11G> with t as (
2 select 'str1|str2|str3||str5|str6' x from dual union all
3 select '|str2|str3|str4|str5|str6' from dual union all
4 select 'str1|str2|str3|str4|str5|' from dual union all
5 select 'str1|str2|||str5|str6' from dual)
6 --
7 select x,
8 regexp_replace(x,'^([^|]*).*$','\1') y1,
9 regexp_replace(x,'^[^|]*\|([^|]*).*$','\1') y2,
10 regexp_replace(x,'^([^|]*\|){2}([^|]*).*$','\2') y3,
11 regexp_replace(x,'^([^|]*\|){3}([^|]*).*$','\2') y4,
12 regexp_replace(x,'^([^|]*\|){4}([^|]*).*$','\2') y5,
13 regexp_replace(x,'^([^|]*\|){5}([^|]*).*$','\2') y6
14 from t;
X Y1 Y2 Y3 Y4 Y5 Y6
str1|str2|str3||str5|str6 str1 str2 str3 str5 str6
|str2|str3|str4|str5|str6 str2 str3 str4 str5 str6
str1|str2|str3|str4|str5| str1 str2 str3 str4 str5
str1|str2|||str5|str6 str1 str2 str5 str6
4 rows selected.
test@ORA11G>
test@ORA11G>isotope
PS - it works for semi-colon character ";" because it is not a metacharacter. So its literal value is considered by the regex engine for matching.
Edited by: isotope on Feb 26, 2010 11:09 AM -
Splitting one column into different columns.
Hello Experts,
How do i split datetime column into different columns while doing a Select statement.
Ex:
The column "REC_CRT_TS" has data like "2014-05-08 08:23:09.0000000".The datatype of this column is "DateTime". And i want it in SELECT statement like;
SELECT
YEAR(DATETIME) YEAR,
MONTH(DATETIME) MONTH,
DATENAME(DATETIME) MONTHNAME,
DATEPART(DATETIME) WEEKNUM,
DAY(DATETIME) DATE,
DATEPART(DATETIME) HOUR
FROM TABLE_NAME;
The output should look like this;
--YEAR| MONTH | MONTHNAME| WEEKNUM | DATE | HOUR
--2014| 5 | May | 25 | 08 |08
Any suggestions please.
Thanks!
RahmanI made a very quick research and I see in this blog post
http://www.jamesserra.com/archive/2011/08/microsoft-sql-server-parallel-data-warehouse-pdw-explained/
that It also uses its own query engine and not all features of SQL
Server are supported. So, you might not be able to use all your DBA tricks. And you wouldn’t want to build a solution against SQL Server and then just hope to upsize it to Parallel Data Warehouse Edition.
So, it is quite possible that this function doesn't exist in PDW version of SQL
Server. In this case you may want to implement case based month name or do it in the client application.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How to display rows of data into different columns?
I'm new to SQL and currently this is what I'm trying to do:
Display multiple rows of data into different columns within the same row
I have a table like this:
CREATE TABLE TRIPLEG(
T# NUMBER(10) NOT NULL,
LEG# NUMBER(2) NOT NULL,
DEPARTURE VARCHAR(30) NOT NULL,
DESTINATION VARCHAR(30) NOT NULL,
CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
The result should be something like this:
> T# | ORIGIN | DESTINATION1 | DESTINATION2
> 1 | SYDNEY | MELBORUNE | ADELAIDE
The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
Thanks!!!T#
LEG#
DEPARTURE
DESTINATION
1
1
Sydney
Melbourne
1
2
Melbourne
Adelaide
1
3
Adelaide
India
1
4
India
Dubai
2
1
India
UAE
2
2
UAE
Germany
2
3
Germany
USA
On 11gr2, you may use this :
SELECT t#,
REGEXP_REPLACE (
LISTAGG (departure || '->' || destination, ' ')
WITHIN GROUP (ORDER BY t#, leg#),
'([^ ]+) \1+',
'\1')
FROM tripleg
where leg#<=3
GROUP BY t#;
Output:
1 Sydney->Melbourne->Adelaide->India
2 India->UAE->Germany->USA
Cheers,
Manik. -
Changing rows into different column names
Hi,
i need to tranpose the rows into differnent column names
my sample data :
id , val
1 3
1 4
1 5
into
id , val1, val2 , val3 , val4 ... valn ..
1 3 4 5
from askTom's i see that it's tranpose into a single column using the ref cursor ?
how can i do made it into different column names ?
kindly advise
tks & rdgsFor example, lets say that you want to order your columns from least value to greatest and that you'll never have more than three values per id. Then you can use the analytic function row_number() like this to create a pivot value.
select id, val,
row_number() over (partition by id order by val) as rn
from your_table;And so your pivot query ends up looking like this.
select id,
max(case when rn=1 then val end) AS val1,
max(case when rn=2 then val end) AS val2,
max(case when rn=3 then val end) AS val3
from (
select id, val,
row_number() over (partition by id order by val) as rn
from your_table
group by id;But notice that I started out by making up answers to Justin's questions. You'll have to supply the real answers. -
Mapping different same column value into different column based on conditio
Hi experts,
We have source as Oracle tables and target also Oracel tables.
Source
Column1|Column2|Column3
Target
trg1|trg2
I need to
insert the value of Column1 into trg1 where column2='xxx'
insert the value of column1 into trg2 where column3='yyy'
After giving the conditions on the mapping, the where conditions are getting clubed with and and I am getting different value than what is excepted. Like the similar way I have the same scenario for most of the columns in my target table. Suggest me how to do it.
Thanks in advance.Hi,
I tried the mapping but getting duplicate records.
case1: Only AND condtion is getting applied automatically as per the joins between tables..i m not able to change the AND to OR condition since there are three table joins.
case2: when i try to execute the separate query for the column, i getting the values once put in case statement only NULL values are getting fetched.
As all my target mapping are like this...lot of issues are getting raised while fetching records...
I have given my scenario once again below.
src1
col1
src2
col1
col2
col3
col4
src3
col1
tar1
col1
col2
mapping given are
tar1.col1 = select src2.col3 where src2.col1='xxx' and src2.col2='yyy' and src2.col4=src1.col1
tar1.col2 = select src2.col3 where src2.col1='aaa' and src2.col2='bbb' and src2.col4=scr2.col1
Kindly suggest how to do the mapping in details...I am stuck bcoz of this mapping......thanks in advance.
Edited by: siva on Nov 23, 2011 12:34 PM -
Parse string into different column and optimization
We are in process of building an audit process for any changes that occur automatically or manually by the user on some of the table data. To do this we have two options:
1. Have master table to store the audit event summary and a detail table to store each column change with old and new values. Something like:
CREATE TABLE TEST_ADT_DTL
EVNT_ID NUMBER,
COL_NAME VARCHAR2(1000),
OLD_COL_VAL VARCHAR2(1000),
NEW_COL_VAL VARCHAR2(1000)
);but this approach has some processing overhead since for the changes to each record there will be multiple records based on number of columns updated. If we are loading 40K transaction twice a month, and the changes are almost 30-40% so the detail table will grow considerably.
2. To have the detail table with one column that will have a concatenated string of changes with field name, old and new values.
CREATE TABLE TEST_ADT_EVNT
EVNT_ID NUMBER,
TBL_NAME VARCHAR2(100),
OPER_CD VARCHAR2(1),
USR_ID VARCHAR2(10),
ACT_DT DATE,
PK_STRNG_VAL VARCHAR2(100),
CMNT_TXT VARCHAR2(1000)
CREATE TABLE TEST_ADT_DTL
EVNT_ID NUMBER,
ADT_LOG VARCHAR2(1000)
INSERT INTO TEST_ADT_EVNT VALUES (1, 'CUSTOMER', 'A', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (2, 'CUSTOMER', 'U', 'ABC', SYSDATE, 'CUS0001', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (3, 'ORDER', 'A', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (4, 'ORDER', 'U', 'EFG', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_EVNT VALUES (5, 'ORDER', 'U', 'XYZ', SYSDATE, 'CUS0002', 'SOME COMMENT');
INSERT INTO TEST_ADT_DTL VALUES (2, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;');
INSERT INTO TEST_ADT_DTL VALUES (4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;');
INSERT INTO TEST_ADT_DTL VALUES (5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;');
COMMIT;I want to know if we want to generate a report for audit log, how can I display the data from detail table in columns. I mean how to parse the ADT_LOG column to show the data in three different columns like:
FIELD OLD NEW
CITY AVENEL EDISON
ZIP 07001 07056
.along with the columns from EVNT table.
And, want to know which approach would be better.hey I think I finally got it using the model clause.
not sure if this will be faster or not.
you can increase the number of iterations if you are not hitting them all,
( the lower your iteration number the faster this will run)
select adt_log, field, old, new from
with TEST_ADT_DTL as
(select 2 evnt_id, 'FIELD:CITY,OLD:AVENEL,NEW:EDISON;FIELD:ZIP,OLD:07001,NEW:07056;' ADT_LOG FROM DUAL UNION
select 4, 'FIELD:ADDRESS,OLD:234 ROGER ST,NEW:124 WEST FIELD AVE;FIELD:STATE,OLD:NJ,NEW:NY;FIELD:PHONE,OLD:,NEW:2012230912;' from dual union
select 5, 'FIELD:MID_NAME,OLD:,NEW:JASON;FIELD:ADDRESS,OLD:,NEW:3 COURT CT;' from dual
select evnt_id, adt_log, field, old, new from test_adt_dtl
model return updated rows
partition by (evnt_id)
dimension by ( 0 d)
measures (adt_log, adt_log field, adt_log old, adt_log new, 0 it_num )
rules iterate (50) -- until ?
adt_log[any] = adt_log[0],
field[0] = substr(adt_log[0], instr(adt_log[0],'FIELD',1,1)+6, instr(adt_log[0],',',1,1) - instr(adt_log[0],'FIELD',1,1)-6),
old[0] = substr(adt_log[0], instr(adt_log[0],'OLD',1,1)+4, instr(adt_log[0],',',1,2) - instr(adt_log[0],'OLD',1,1)-4),
new[0] = substr(adt_log[0], instr(adt_log[0],'NEW',1,1)+4, instr(adt_log[0],';',1,1) - instr(adt_log[0],'NEW',1,1)-4),
field[iteration_number ] = substr(adt_log[0],
instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6,
(instr(adt_log[0],',',( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6 ),1)
( instr(adt_log[0],'FIELD:',1,iteration_number + 1 ) + 6))
old[iteration_number ] = substr(adt_log[0],
instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4,
(instr(adt_log[0],',',( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4 ),1)
( instr(adt_log[0],'OLD:',1,iteration_number + 1 ) + 4))
new[iteration_number] = substr(adt_log[0],
instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4,
(instr(adt_log[0],';',1,iteration_number + 1)
(instr(adt_log[0],'NEW:',1,iteration_number + 1 ) + 4)
order by evnt_id, it_num
where new is not nullEdited by: pollywog on Apr 13, 2010 10:28 AM -
Web App CSV Export Puts Everything into 1 Column in Numbers 3.0
Hi
Anyone have this issue before where the new Numbers by Apple, takes the web app export CSV and throws all data into one column? It displays the Template downloads just fine. Just not the Exports for Web App Items.
Any tricks?
TeejayOh and the reason likely that has happened because if you do some HTML structures in the content it breaks the import/export process a bit.
-
Referencing different columns in Numbers 3.0
Hello,
I am refernecing differnt columns on differnt sheets, for eample I am typing =A1 in column D and copying and pasting the whole column to have D match A. The problem I am having is that some of the cells are blank in column A and need to stay that way when mimiced , but it is inserting an "0" in the coorisponding colmn D cells. Is there any way to have it blank also?
Thank you,
Mannymanny,
tp refer to a cell in a different sheet and table you use the form:
<SHEET_NAME>::<TABLE_NAME>::<CELL>
so if the sheet if named "Sheet 1"
and the table is named "Table 2"
and the cell you want to reference is A1
you would enter "=Sheet 1::Table 2::A1" without the double quotes
So...
=if(isblank(A), "", A)
should be
=if(isblank(Sheet 1::Table 2::A1), "", Sheet 1::Table 2::A1) -
Data saggrigation into different columns
Hi,
I need help on following:
i have data in the table as
col1 col2
3 343
3 567
3 333
3 987
3 987
there are other column too. I have to populate this like:
col1 c1
3 (1) ---- 35399
3 (2) ---- 46388
3 (3) ---- 37377
Let me explain this:
col1 defines how many columns col2 will have. There will be definite 10 rows (per record set).
the out put will have 3(1) are records of row1 in col2... like wise.
Col2 can have maximum of 26 columns. This means result set will have max 26 rows.
Please let me know if there is confusion in requirement.
Thanks
Edited by: user2544469 on Feb 9, 2011 4:38 AMuser2544469 wrote:
Hi,
I need help on following:
i have data in the table as
col1 col2
3 343
3 567
3 333
3 987
3 987
there are other column too. I have to populate this like:
col1 c1
3 (1) ---- 35399
3 (2) ---- 46388
3 (3) ---- 37377
Let me explain this:
col1 defines how many columns col2 will have. columns do not contain columns. Columns do not contain "fields". I think you need to go back and revisit the basic rules of data normalization, and get this data model to third normal form.
There will be definite 10 rows (per record set).
the out put will have 3(1) are records of row1 in col2... like wise.
Col2 can have maximum of 26 columns. This means result set will have max 26 rows.
Please let me know if there is confusion in requirement.
Thanks
Edited by: user2544469 on Feb 9, 2011 4:38 AM -
Hi all,
I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
[Arbeitstag], [Pecunia], [Mita], [Kunde], [Auftrag] and [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
Please if any one could help me. i searched a lot in different forums but couldn't find me a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
*& Report ZDEMO_ZEITERFASSUNG9
REPORT ZDEMO_ZEITERFASSUNG9.
Types: Begin of ttab,
Rec(1000) type c,
End of ttab.
DATA: itab type table of ttab.
DATA: wa_tab type ttab.
DATA: file_str type string.
Parameters: p_file type localfile.
At selection-screen on value-request for p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
STATIC = 'X'
* MASK = ' '
CHANGING
file_name = p_file.
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
Start-of-Selection.
file_str = P_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT' " This the file source address
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = ';'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP at itab into wa_tab.
WRITE: / wa_tab.
ENDLOOP.
I will be grateful to all you experts for ur inputs
regards
Chandan SinghFor every Auftrag, there are multiple Position entries.
Rest of the blocks don't seems to have any relation.
So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
Try out this snippet.
DATA lt_data TYPE TABLE OF string.
DATA lv_data TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:\temp\test.txt'
CHANGING
data_tab = lt_data
EXCEPTIONS
OTHERS = 19.
CHECK sy-subrc EQ 0.
TYPES:
BEGIN OF ty_str,
a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
p1 TYPE string,
p2 TYPE string,
p3 TYPE string,
END OF ty_str.
DATA: lt_str TYPE TABLE OF ty_str,
ls_str TYPE ty_str,
lv_block TYPE string,
lv_flag TYPE boolean.
LOOP AT lt_data INTO lv_data.
CASE lv_data.
WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
lv_block = lv_data.
lv_flag = abap_false.
WHEN OTHERS.
lv_flag = abap_true.
ENDCASE.
CHECK lv_flag EQ abap_true.
CASE lv_block.
WHEN '[Auftrag]'.
SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
WHEN '[Position]'.
SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
APPEND ls_str TO lt_str.
ENDCASE.
ENDLOOP. -
Passing data to different internal tables with different columns from a comma delimited file
Hi,
I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region). Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
There is a split statement (split at comma) used to break the data into different columns.
I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
Thanks,
PavanHi Abhishek,
I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
I also have region B( say Europe) whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
If some one loads file related to Asia and the file has only 4 fields then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
Thanks,
Pavan -
Very frustrating. In previous versions of the shuffle I was able to select to listen to all podcasts in a row automatically. Now I can't seem to figure it out, I tried creating a playlist as I do with music, however the shuffle is smart and figures they are podcasts so just enters them in as such. Then I go to play them and it separates them into different playlists depending on the podcasts.
Engineers: it wasn't broken to begin with so stop playing around with features and just create something usable... maybe it's too much to expect from Apple with Steve Jobs gone. A waste of $50 if you can't help me figure it out.whether or not the genre has been "rebranded" to music
FYI - The way to "rebrand" an item to reclassify it as a different type of iTunes media is NOT with the Genre setting. Instead, select the item in iTunes and do a Get Info. In the Info window, go to the Options tab. Change Media Kind to Music, Podcast, Audiobook, etc. Changing the Genre setting does nothing to change how iTunes categorizes the item.
I loaded a couple Music playlists to see what would happen.
Playlists are playlists... There in no distinction between a "Music" playlist and a "Podcast" playlist. It's up to you do load them as desired.
If I actually wanted those music playlists to function as such, though, I'd be out of luck.
I don't understand. Just load a playlist that only has podcasts on it (your "Podcast playlist"), AND one or more other playlists that only have music. Then VoiceOver will read then off separately, and you can choose the one you want to hear. If you take a look at the artcle I linked previously
http://support.apple.com/kb/HT4322
where is says Changing playlists and To choose an item from the playlist menu, your description basically matches what it says there. So, glad to hear your shuffle is working as designed... -
I want to convert a series of names into a table (in either numbers or pages). The list I have has a name and then an email address in brackets, followed by a 'yes' or a 'no'. I would like to separate the list into three columns - the first containing the name, the second containing the email address and the third containing the 'yes' or 'no'.
Can you help me ?The question that needs to be answered is what is separating the columns? Is it a single tab, one or more tabs, spaces, or what? Or is it the brackets that makes the separation between the three pieces of data?
If it is always a single tab, that makes it really easy. All you have to do is find/replace the brackets with nothing (as Wayne said)
If it might be multiple tabs, you can find/replace tab-tab with a single tab and repeat that a few times until no more double-tabs are found.
If it is one or multiple spaces, that might be difficult. I'll think about this one if this is what you have. I'll ignore this possiblility for now.
If it is the brackets separating the three pieces of data, you would Find/Replace the left bracket with a tab then do the same with the right bracket.
Maybe you are looking for
-
When I click on the plus sign by tabs, a burgundy blank screen appears over my window, blocking the tab groups except for the top portion. I can still see the URL address field and the tabs above but when I click on a tab, it comes up beneath the bla
-
How do I find the AS that this links to in my flash file via "find"?
I have a flash file that I have on a web page. When I hover over the Join Us image, the mouse changes to a hand. I can click on the "button" but it doesn't take me anywhere. I'm trying to find out if there is a way to find the link in my Flash file v
-
HP Laserjet 4mp won't print with Snow Leopard
My great Laserjet 4mp prints just fine with OS 10.5.8 but not with Snow Leopard (10.6.2) on my new iMac. Have spent three plus hours with senior level Mac Techs to no avail. The printer screen shows the correct printer and driver and indicating valid
-
How to cancel screensavers ?? thanks a lot!
anybody help me pls, how to cancel "screensavers" --- this application program in solaris 2.6 open windows environment? thanks a lot!!
-
New-csEXUmContact does not generate any output or create a contact
Hi, I have Lync 2013 on Prem and Exchange o365. I am trying to create a Auto attendant as per this article: http://ahandyblog.wordpress.com/cloud-technologies/office-365-auto-attendant-with-lync-2013-on-premise/ but when I execute the New-csEXUmCont