How to do this?  More words in one field - split the words

Hello Hello,
I have a simple question about a simple database arrangement.
But the family name and first name are in the same field(column).
I would like to have a database with the first name - family name(s) in different fields.
So when for example the database has Willem De Wortel in one field
I would like to get a database with 3 more fields First name - Family 1 - Family 2
So the first word is the first name : Willem
and the second field is second name : De and the third field is third name : Wortel. For Willem Van De Wortel : I get 4 columns
So the script should see at 1 column in the database.
And make more columns for every word in that column.
So I think most of times I get a database with 4 extra columns
First name - Second name - third name - fourth name
I prefer to make extra columns starting next to the selected column
so I get a new database tab delimited mac os roman with (most of the times) 4 extra columns where the name is separated in more columns. And the new columns are next to the original column.
I hope some one understand me.

Hello Colin,
Here it goes. Try this one.
May this work well.
Hiroto
P.S. Sorry I misspelled your name in previous posts...
--SCRIPT 2
E.g.
infile.txt (; denotes tab)
name;field2;field3;field4
d11;d12;d13;d14
d21;d22;d23;d24
d31;d32;d33;d34
d41;d42;d43;d44
* Here, the 1st field is for name
outfile.txt (; denotes tab)
name;name 1;name 2;...;name 9;name 10;field2;field3;field4
d11;d11[1];d11[2];...;d11[9];d11[10];d12;d13;d14
d21;d21[1];d21[2];...;d21[9];d21[10];d22;d23;d24
d31;d31[1];d31[2];...;d31[9];d31[10];d32;d33;d34
d41;d41[1];d41[2];...;d41[9];d41[10];d42;d43;d44
* X denotes X's i'th substring delimited by space
(If X is in double quotes, each X is also enclosed in double quotes)
e.g.,
Given X = "Willem Van De Wortel",
X[1] = "Wililem"
X[2] = "Van"
X[3] = "De"
X[4] = "Wortel"
X[5]..X[10] = (empty)
on run
open (choose file with prompt "Choose input file") as list
--open (choose file with prompt "Choose input file(s)" with multiple selections allowed) as list -- AS1.9.2 or later
end run
on open aa
repeat with a in aa
set infile to a as string
set {p, m, x} to {|parent|, |name stem|, |name extension|} of getPathComponents(infile)
set outfile to p & m & "-converted" & x
main(infile, outfile)
end repeat
end open
on main(infile, outfile)
string infile : HFS path of input file
string outfile : HFS path of output file
script o
property targetfield : 1 -- # target field index
property subfields : {¬
"name 1", "name 2", "name 3", "name 4", "name 5", ¬
"name 6", "name 7", "name 8", "name 9", "name 10"} -- # additional sub field's names
property sublen : count subfields
property text_class : string -- # input & output text class [1]
--property text_class : «class utf8» -- UTF-8
[1] Input and output text class (: text encoding)
string : System's primary encoding; e.g. Mac-Roman
«class utf8» : UTF-8
Unicode text : UTF-16BE
property ORS : return -- # output record separator
--property ORS : linefeed
property pp : {}
property qq : {}
property rr : {}
property mm : {}
-- (0) read input file
set t to read file infile as text_class
set pp to t's paragraphs
-- (1) build new header row
set h1 to my pp's item 1 -- original header row (from line 1 of infile)
set hh1 to text2list(h1, tab)
set hh1's item targetfield to {hh1's item targetfield} & subfields -- add new sub fields
set h to list2text(hh1, tab) -- new header row
set qq to {h}
-- (2) process each data row (line 2 .. line -1)
repeat with i from 2 to count my pp --pp's item i is data row (i - 1)
set p to my pp's item i
if p = "" then -- skip any empty row
set end of qq to p
else
-- get row data, name and name components
set rr to text2list(p, tab) -- current row data
set n to my rr's item targetfield -- full name
set mm to text2list(n, space) -- name components delimited by space
-- special treatment in case name is enclosed in double quotes
if n starts with """ then -- original name is in double quotes
set mm to text2list(list2text(my mm, """ & tab & """), tab) -- quote every component
end if
-- adjust name components' length to match the given field length
set delta to sublen - (count my mm)
repeat delta times
set end of my mm to "" -- pad "" to end
end repeat
if delta < 0 then set mm to my mm's items 1 thru sublen -- truncate any extra, just in case
-- build new row data
set my rr's item targetfield to {n} & my mm
set end of my qq to list2text(my rr, tab)
end if
end repeat
-- (3) build output text and write it to output file
set t1 to list2text(qq, ORS)
writeData(t1, outfile, {_append:false, class:textclass})
return t1
end script
tell o to run
end main
on list2text(aa, delim)
list aa : source list
text delim : text item delimiter in list-text coercion
local t, astid, astid0
set astid to a reference to AppleScript's text item delimiters
try
set astid0 to astid's contents
set astid's contents to {delim}
set t to "" & aa
set astid's contents to astid0
on error errs number errn
set astid's contents to astid0
error "list2text(): " & errs number errn
end try
return t
end list2text
on text2list(t, delim)
text t : source text
text delim : text item delimiter in text-list conversion
local tt, astid, astid0
set astid to a reference to AppleScript's text item delimiters
try
set astid0 to astid's contents
set astid's contents to {delim}
set tt to t's text items
set astid's contents to astid0
on error errs number errn
set astid's contents to astid0
error "text2list(): " & errs number errn
end try
return tt
end text2list
on writeData(x, fp, {append:append, class:class})
data x: anything to be written to output file
string fp: output file path
boolean _append: true to append data, false to replace data
type class _class: type class as which the data is written
local fref
try
set fref to open for access (file fp) with write permission
if not _append then set eof fref to 0
write x as _class to fref starting at eof
close access fref
on error errs number errn
try
close access file fp
on error --
end try
error "writeData(): " & errs number errn
end try
end writeData
on getPathComponents(a)
alias or HFS path string : a
return record : {|parent|:p, |name|:n, |name stem|:m, |name extension|:x}, where -
p = parent path (trailing colon inclusive)
n = node name (trailing colon not inclusive)
m = node name without name extension (trailing period not inclusive)
x = name extension (leading period inclusive; i.e. n = m & x)
local astid, astid0, fp, p, n, m, x
set astid to a reference to AppleScript's text item delimiters
set astid0 to astid's contents
try
-- (0) preparation (strip trailing ":")
set fp to a as Unicode text
if fp ends with ":" and fp is not ":" then set fp to fp's text 1 thru -2
-- (1) get node's parent path and node name
set astid's contents to {":"}
tell fp's text items
if (count) ≤ 1 then
set {p, n} to {"", fp}
else
set {p, n} to {(items 1 thru -2 as Unicode text) & ":", item -1}
end if
end tell
-- (2) get node name stem and extension
set astid's contents to {"."}
tell n's text items
if (count) ≤ 1 then
set {m, x} to {n, ""}
else
set {m, x} to {items 1 thru -2 as Unicode text, "." & item -1 as Unicode text}
end if
end tell
set astid's contents to astid0
on error errs number errn
set astid's contents to astid0
error "getPathComponents(): " & errs number errn
end try
return {|parent|:p, |name|:n, |name stem|:m, |name extension|:x}
end getPathComponents
--END OF SCRIPT 2
Message was edited by: Hiroto (fixed the code a bit)

Similar Messages

  • 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.

  • How many meetings can be opened by one account at the same time?

    I've tried Adobe Connect trial version.
    There are few questions about the product.
    1.How many meetings can be opened by one account at the same time?
       I could open 9meetings at the same time using other PCs. What is the limit?
    2.What is the maximum of students in a meeting?
       I'm thinking of buying monthly/Individual product.
    3.The meeting never end even though host is out of it. But we want to control.
       Can host close a meeting so that all participants are out of the session?
    Thanks for your attention.

    This depends on your licensing.
    If you are using a Named Host license, then you can open one meeting at a time. If other members of the Meeting Host group are present in a room, then it should allow you to have multiple rooms open, one for each Meeting Host licensing being used.
    If you are using the Concurrent Learner license, then each meeting you join uses a different licenses, so as long as you have concurrent seats available, you can open as many rooms as you want/need.
    Maximum number of attendees (students) would be your room's concurrent maximum, less your self. The monthly version of Connect offers 25 concurrent attendees in each room, so that would be 24 students and you.
    The meeting does end after it is dormant (no host) for ~15 min, however you can use the End Meeting function (Meeting > End Meeting) to close the meeting and remove everyone, including yourself, from the room.

  • I am using a PC and when I try to download an ebook, I get a pop up prompt with the message `Error! Check Activation` - how to resolve this so I can download and view the ebook, thank you

    I am using a PC and when I try to download an ebook, I get a pop up prompt with the message `Error! Check Activation` - how to resolve this so I can download and view the ebook, thank you

    Hi Ablondel24,
    I understand that you are getting a 404 message when you access a website from a Mac, not a PC.
    First check the cache for the site:
    Reload the webpage while bypassing the cache using '''one''' of the following steps:
    *Hold down the ''Shift'' key and click the ''Reload'' button with a left click.
    OR
    *Press ''Command'' + ''Shift'' + ''R'' (Mac)
    Second try to [[Delete cookies to remove the information websites have stored on your computer]]
    Let us know if this solves the issues you are having.

  • At the top of my homepage, I'm getting a message "Downloading the latest applications", but the circle to the left keeps spinning, and no applications are downloaded. I don't know how to stop this, tried right and left clicking on the bar. This occurs

    At the top of my homepage, I'm getting a message "Downloading the latest applications", but the circle to the left keeps spinning, and no applications are downloaded. I don't know how to stop this, tried right and left clicking on the bar. This occurs every time I open Firefox. How can I stop or disable this?
    == This happened ==
    Every time Firefox opened
    == Several weeks ago.

    See http://kb.mozillazine.org/Software_Update (Software Update not working properly)
    Remove the files in the ''updates'' and ''updates\0'' folder:
    Vista/Windows7:
    C:\Users\&lt;user&gt;\AppData\Local\Mozilla\Firefox\Mozilla Firefox\ (updates)
    C:\Users\&lt;user&gt;\AppData\Local\VirtualStore\Program Files\Mozilla Firefox\ (updates)
    %LOCALAPPDATA%\Mozilla\Firefox\Mozilla Firefox\updates\

  • How can i add one field in the container for the standard task-90310004?

    Hi,
    Please let me know thw steps to add one field in the container for the standard task-90310004.
    Usefull suggestions will be rewarded.
    Regards,
    Neslin.

    <b>Hi,
    Containers are used for holding Application data for Workflow purposes.
    Event container
    Task container
    Workflow container
    Role container
    Binding is the linking of data from one container to the other for making data available all across the workflow.
    But you can get values from one container to another container like this
    Container(Con)
    1. WF Con to Role, Wf con to task con, Wf con to event
    and
    2. Event con to wf con, task con to wof con
    and
    3. Method con to task con
    and
    4. Task con to method con
    So, we don't have direct possible binding from task con to task con.
    Thanks and Regards,
    Prabhakar Dharmala</b>
    Message was edited by:
            Prabhakar Dharmala
        But you can do pass values from first task con to wf con and again from wf con to another task con

  • HT5449 How do I get dictation I know when I want the word period and not a full stop.

    How do I get dictation I know when I want the word period and not a full stop.

    Try the alternatives: "point," "dot," and/or "full stop." Do any of these options produce a period for you? And, as a different punctuation test, does something such as "comma" work for you?

  • How can I use word count without it counting the words in the end notes by default?

    How can I use word count without it counting the words in the end?
    Now I have to highlight the text to get a count.

    I don't think that is possible, it does what it does.
    Peter

  • Whenever i raise the volume to the highest level the purity of the sound decreases how to solve this problem ??, whenever i raise the volume to the highest level the purity of the sound decreases how to solve this problem ??

    whenever i raise the volume to the highest level the purity of the sound decreases how to solve this problem ??, whenever i raise the volume to the highest level the purity of the sound decreases how to solve this problem ??

    Spend at least $350 on headphones. The problem is not the quality of the output from the device, it's expecting a pair of $29 headphones to perform above and beyond what they were designed for.

  • RoboHelp 8 vs. 9 - Search Functionality Comparison and "All of the Words" vs. "Any of the Words"

    Greetings!
    Our organization focuses a lot on the accuracy of our searches, which is a necessity when we have hundreds of very lengthy topics (no matter how well organized they are).
    I finally completed a detailed comparison of the search functionality of 8 and 9 and came to the realization that 8 is a disaster, while with 9 things get better, but there's still TONS of room for improvement.  I have reported this to Adobe and so far there has been no official response. There are many blogs on here related to the search functionality, but I thought it may be a good idea to try to sum some of them up. I do hope that someone somewhere at Adobe runs into this and shares with all of us why Adobe's Search functionality is still in the 20th century!
    I hope this helps everyone else who is curious to know about how the tool's search functions work and whether it's worth upgrading from 8 to 9 at this point. I have included some examples which are in a way internal to us, but they will give you a good idea of what to expect and I'm quite confident you'll be able to recreate them on your side in seconds.
    I also wanted to ask a question or two, and if anyone can assist, that would be greatly appreciated:
    Currently if we search for several words at once (not exact phrase), both 8 and 9 perform an "Any of the words" search which always returns too many results. Does anyone know a way to change the default to an "All of the words" search? For years I have not encountered a tool out there that doesn't have the option to modify this, alas with RoboHelp 8 and 9, we can't find a way to do it (with or without modifying the source code).
    Out of curiosity, are there any other tools out there which offer Conditional Tag (or similar) functionality and which behave better than RoboHelp? (easier to maintain, less buggy, web interface, etc)?
    RoboHelp 8 vs 9 - Search Functionality Comparison Table with some Examples:
    Search Example              
    RoboHelp 8     
    RoboHelp 9        
    Expected Results
    (based on industry standards)
    1. Searching for Exact Phrase "Correspondent Banking"
    Such a search returns topics which contain "Correspondent Banking" and "Correspondent Bank". The last one is included because "Bank" is the root of "Banking". The topics that contain the exact phrase appear at the bottom. When we click on any of them, we're not automatically taken to phrase so we have to scroll and look for it or use CTR+F.
    Identical behavior except that when we click on the topics which contain the exact phrase, we're taken straight to it.
    When we hear "exact" we expect "exact" and nothing else. Unfortunately, both versions keep searching for the roots of each word as well and incorrectly display those results at the top. Adobe has made it clear that this is a part of their functionality, BUT this is something we would not expect to see for exact phrase searches that are in quotes.
    2. A Non-Exact phrase search of "Geographical Limits of market area"
    The tool automatically performs an "Any of the Words" search instead of an "All of the Words" search. This is also related to the question I asked above this table. As you can imagine, this is returning almost every topic and it becomes virtually impossible to find what we're looking for. It even returns topics which contain "of" and nothing else.
    Identical behavior
    There to be an option which allows us to choose what the default search would be - "Any of the words" vs. "All of the Words"
    3. Exact Phrase search of "low-score" with a dash
    None of the topics that were returned contain the phrase. As some of you know, RH8 has problems with special characters, including dashes.
    RH9 returned only the topic that which contains the phrase and we were taken straight to it when we open it.
    The expectation is to see exactly what RH9 currently offers. Unfortunately 8 has a big problem with these types of searches.
    4. Exact Phrase search of "2.4"
    This is similar to the one above. Adobe doesn't like periods as well. It doesn't not find any of the topics which contain this phrase. In our case, this is a section number and sometimes people want a quick way to get to a specific section or sub-section.
    We were hoping that this will be fixed with 9, just the way they fixed the dashes. Unfortunately, still ZERO results returned.
    Expectation is for the topics which contain that exact phrase to be returned, no matter whether there's any special character inbetween.
    5. Exact Phrase search of "300,000" or $300,000"
    The tool only returned several random topics which contain "000" as part of larger numbers. The topic that contains "300,000" was not on that list, even though it also contains "000".
    Identical behavior
    Expectation is for topics that contain the exact amount to be returned, no matter if there is a coma or a dollar sign anywhere within the phrase.
    6. Exact Phrase Search of "525-B5". Goal was to have a special character, a letter and numbers.
    ZERO Results returned.
    Only the docs that contain the phrase were returned and nothing else. It seems that this this was addressed in version 9 and now it behaves as expected.
    Expectation is only for the docs that contain the exact phrase to be returned.
    7. Exact phase search of "log" in order to test the Substring Functionality
    Here's an extract from Adobe's Support Site:
    “Substring search (WebHelp/Pro, FlashHelp/Pro) - If you enable this feature, a search for "log" returns topics containing the words "catalog" and "logarithm." Substring search takes longer than whole-string search.”
    So with that in mind, we decided to test if turning the substring searches on and off does exactly as advertised, unfortunately the answer was NO. We even used an example almost idnetical to what Adobe provided on their site.
    With Substring Searches disabled, we searched for the word "log". Unfortunately it returned words like "logbook" and methodology". How is that possible?
    Identical behavior
    Our expectation would be only for docs that contain"log" to be returned, no matter whether substring is enabled or disabled. In our case it was disabled.

    Hi there
    Out of curiosity, why is it that you expect to hear from Adobe? I'm hoping it's not simply because you posted here. Certainly we have Adobe folks that visit here and we are thankful for that, but it isn't to be expected.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • In BDCs, after adding one field to the screen, which one is the better proc

    Hi,
    My client requirement In BDCs, after recording the legacy data by using MM01, After some time adding one field to the screen, How can we record the  for the new field.
    If any one knows pls help me total process.
    Warm regards,
    Venkat.

    Identify the screen in which this new field is added and simply add one more line to add the bdc record for this field in that screen.
    If the screen is also entirely new, then you have to identify the previous screen, the okcode to go to this new screen and finally the next screen and the okcode to go to the next screen along with the field BDC record.
    I don't think it is necessary to redo all the recording as long as you can follow the existing code.

  • How to bind JtextFields in Swing to Table fields in the database

    Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
    Am really new to java programming and have interest in learning

    The standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
    You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started.

  • I just tried to copy text from power point to a word document. Since then the word document is frozen an shows no reaction. Also can not restart word. Can anyone help me to unfreeze or recover the word document?

    I just tried to copy text from power point to a word document. Since then the word document is frozen an shows no reaction. Also can not restart word. Can anyone help me to unfreeze or recover the word document?

    If the PDF page content is an image (for text that'd by the image that any scanner provides) then it is an image that exports to Word.
    Regardless, Adobe Reader cannot export PDF page content, cannot create PDF and cannot manipulate PDF page content.
    Adobe Reader is a PDF viewer only.
    Perhaps you have a subscription to one of Adobe's online subscription services.
    (ExportPDF, PDF Pack, etc.)
    Each of the online subscription services have their own dedicated user-2-user forums.
    Easy find as there here in Adobe's Forums. Hmmm, just dumping somewhere means ... Ah well, won't go there. Miss Manners would not approve eh.
    Resources for getting into a dialog with Adobe:
    (other than the user-2-user forums)
    ~~~~~~~~~
    To contact support for acrobat.com subscription services: 
    https://www.acrobat.com/misc/en/contact-support.html 
    Other links to support:
    http://helpx.adobe.com/contact.html
    http://helpx.adobe.com/support.html
    contact Adobe Customer Care on Twitter @AdobeCare.
    Phone support (for a fee - have credit card ready)
    800-833-6687, Mon - Fri, 5AM - 7PM PT 
    Be well...

  • Add one field on the screen.

    hi ,everybody.
    i want to add one field on the progam SAPMV10A,it is VD05,The screen number is 300.the field name is TVLV-ABRVW.How can i do,thank you.

    Check here:
    SPRO --> Financial Accounting --> Accounts Receivable and Accounts Payab;e --> Customer Accounts -> Master data --> Preparations for creating customer master data --> Adoption of Customer's own master data fields --> Businees Add-in:....

  • How do I add more pages in one document?

    Hi everyone.
    In the past I've downloaded a PDF file containing several pages of sheet music.
    How do I produce a PDF file with several pages in it?
    I'm only able to convert a BMP file to a PDF file with just one page. How do I include more than one page in my own PDF file?
    Regards,
    Richard Steed

    Hi Richard,
    Thanks for posting. Unfortunately, I'm not entirely sure I know what you mean when you say that you'd like to "add more pages" - when you're converting a file to PDF, the resulting file (.pdf) will have the same number of pages as the original file (in this case, .bmp). If you're starting with a one-page .bmp, you'll end up with a one-page .pdf after conversion.
    I hope I'm understanding you correctly. Please reply and let me know if you need more information; the more details you can give me about what you're trying to accomplish, the easier it will be for me to help you figure it out!
    Thanks, Richard. Keep me posted.
    Rebecca

Maybe you are looking for