Need to split last name from full namek to sort

I have a column of names, either "John & Jane Doe" or "Jane Doe". I need to sort on the last name. How do I split off the last name to do a proper sort?

Enhanced again
--[SCRIPT Nom_Prénom"]
(* take care of coupound names as
"Charles de Gaulle" --> "Charles" and "De Gaulle"
"William De Foe" --> "William" and "De Foe"
"Walter John de la Mare" --> "Walter John" and "De la Mare"
"François de La Rochefoucauld" --> "François" and "De La Rochefoucauld"
set avant to the clipboard as text
if avant is not "" then
set avant2 to every paragraph of avant
repeat with i from 1 to count of avant2
set ti to item i of avant2
set offs to offset of " de " in ti
if offs > 0 then
set ni to "De " & text (offs + 4) thru -1 of ti
set ti to text 1 thru (offs - 1) of ti
else
set AppleScript's text item delimiters to " "
set mots to every text item of ti
set mi to items 1 thru -2 of mots
set ni to item -1 of mots
set ti to mi as text
end if
set AppleScript's text item delimiters to ""
set item i of avant2 to ti & tab & ni
end repeat
set AppleScript's text item delimiters to return
set avant to avant2 as text
set AppleScript's text item delimiters to ""
set the clipboard to avant
end if
--[/SCRIPT]
Yvan KOENIG (from FRANCE mercredi 12 décembre 2007 13:59:8)

Similar Messages

  • Separate First/Last names from Field?

    Greetings
    I have a table in which the first and last names are in one
    field (?) which I need to get into their own fields.
    I would create a new table:
    CREATE TABLE new_table
    AS
    SELECT #SpanExcluding(?, ?)# as last_name
    #SpanExcluding(?, ?)# as first_name
    FROM existing_table; ?
    Any help would be appreciated.
    newportri

    You would use the string manipulation tools available to you
    in your
    database management system of choice to split the string of
    one field
    into to values to update the two new fields you create.
    This answer is a bit vague, because all the different
    database
    management systems out there offer slightly different string
    manipulation functions.
    But I believe your SQL is going to look a bit like this. I
    may be a bit
    off here since I don't do this type of data manipulation very
    often.
    UPDATE myTable
    SET
    firstName = left(fullName,find(fullName,' ')),
    lastName = right(fullName,find(fullName,' '))

  • Need to remove LAST NAME only in merged letter

    Here's my quandry. Client supplied a mail list with full name in column one. It's okay for the addressing portion, but in the salutation she wants to remove just the last name. I already merged my 2900 name list.
    So I have:
    Mary and John Smith
    123 Main St.
    Your Town, State Zip
    Dear Mary and John Smith,
    Then body of letter.
    I would need a way to search for any space and word before the comma and return in this one line only. Remove the space and last name so the comma slides over after John. I don't want to strip out any other words before a comma. I checked and I believe no line in the letter has a hard return following a comma.
    Doable? If so, how?

    Or you could search for \s[\l\u|\-]+(,)$ and replace with $1 to remove the last name and leave the comma next to the last word in the first name. this must be done as a find/change rather than a GREP style.
    Colin's method is nice in it can be a style, but it leaves "space" between the last visible name and the comma because the text is still present. Colin "escaped" the comma in his version, too, but is seems to make no difference in my test.

  • Retrieve file name from full file path

    I am trying to retrieve a file name from a path (ex. c:\temp\tes.txt) using the following code, but it is given me an error of "The method split(String) in the type String is not applicable for the arguments (char).
    {code}
    String filepath = item.getName();
    String[] buf = filepath.split('/');
    String filename = buf[buf.length-1];
    {code}
    I tried to use double quote instead of single quote, but it is not returning anything.
    {code}
    String[] buf = filepath.split("/");
    {code}
    Anyone knows why? Thanks.

    How is this related to JDBC?
    Anyway, is the path separator actually a forward slash? Isn't it a backward slash?
    If you're using Apache Commons FileUpload (which I guess, the 'item.getName()' is recognizeable), then just read their FAQ: [http://commons.apache.org/fileupload/faq.html#whole-path-from-IE].

  • How to break first,last name from rows to columns?

    drop table t1;
    create table t1
    (c1 varchar2(100)
    insert into t1
    values(' <First Name >david </First Name>');
    insert into t1
    values(' <Last Name > smith </Last Name >');
    insert into t1
    values(' <First Name >Harry </First Name >');
    insert into t1
    values('<Last Name > Bird </Last Name >');
    select * from t1;
    C1
    <First Name >david </First Name>
    <Last Name > smith </Last Name >
    <First Name >Harry </First Name >
    <Last Name > Bird </Last Name >
    4 rows selected.
    out put should be
    First Last
    David Smith
    Harry Bird
    Thanks

    If homework I'd probably be looking at the string manipulation functions. If a real application I'd be looking at a different table design, and given that these look like xml tags that are or should be defined in a schema, using XMLDB.
    Niall Litchfield
    http://www.orawin.info/
    drop table t1;
    create table t1
    (c1 varchar2(100)
    nsert into t1
    values(' <First Name >david </First Name>');
    insert into t1
    values(' <Last Name > smith </Last Name >');
    insert into t1
    values(' <First Name >Harry </First Name >');
    insert into t1
    values('<Last Name > Bird </Last Name >');
    select * from t1;
    C1
    <First Name >david </First Name>
    <Last Name > smith </Last Name >
    <First Name >Harry </First Name >
    <Last Name > Bird </Last Name >
    4 rows selected.
    out put should be
    First Last
    David Smith
    Harry Bird
    Thanks

  • Wrong replication of partner "last name" from CRM to ECC.

    Hi everyone,
    In the specific environment of our company, we create business partners in CRM using t-code 'BP'  they are then instantly replicated to ECC (we visualize them using t-code 'XD03').
    When we create a partner as a person, the fields 'first name' and 'last name' (which are 2 distinct zones ) are concatenated into one single zone when replicated into ECC. I have visualized BDOCS using t-code SMW01, and haven't seen anything abnormal.
    I have been trying to debug the replication process, without any success.
    Please any clues on what I should do to get the problem solved would be very much appreciated.
    Many thanks
    C.K.

    Hi Rashi,
    Sorry for the late reply.
    Goto ECC system and find the FM "BAPI_SALESDOCU_PROXY_UPLOAD" and set the break point using your RFC user id (RFC user id from CRM to ECC and RFC user id should have the debug rights).
    Once you create the order in CRM and it will come to debug in ECC.
    Check TI_EXTENSION_IN tables whether your values are coming in.
    If not your CRM Middleware BADI coding was not done correctly.
    Hope this would help you.
    Regards,
    Bala

  • Database Name from Full Client

    How can we know the Universe parameters from Full Client. I donu2019t have an access to Designer and Supervisor(BO 6.5). I am using desktop Intelligence to run a particular report and I want to know from which database(schema) the report is fetching the data.

    Hello,
    the Data Provider function "Connection" returns a string with various parameters.
    Parse/search for the substring "DATABASE=".
    HTH, best regards
    Thomas

  • Need help returning correct name from a code created movie clip

    Hello. I am an AS3 n00b with hopefuly a simple question I am designing a simple game in flash. This code creates an array of movie clips and asigns a picture to each one. It is a map screen. What I need is when I click on one of the created movie clips, I need it to return either the index of the clip in the array or the name of the clip. Basicaly anything I can use to tell them apart in the code. Here is the code:
    import flash.display.MovieClip;
    var MapLoader:Array = new Array();
    var strJPGext:String = ".jpg";
    var intContTileNumber:int;
    var strContTilePath:String;
    var intDistStartX:int = 63;
    var intDistStartY:int = 64;
    var intDistMultiplyY:int = 0;
    var intDistMultiplyX:int = 0;
    var intDistCount:int = 0;
    var MapSquare:Array = new Array();
    for (var i:int = 0; i < 729; i++)
             //var MapSquare:MovieClip = new MovieClip();
            MapSquare.push (new MovieClip());
            MapSquare[i].x = intDistStartX + (intDistMultiplyX * 30);
            MapSquare[i].y = intDistStartY + (intDistMultiplyY * 30);
            MapSquare[i].name = "MapSquare" + i ;
            addChild(MapSquare[i]);
            intContTileNumber = i;
            MapLoader.push (new Loader);
            strContTilePath = intContTileNumber + strJPGext;
            MapLoader[i].load(new URLRequest(strContTilePath));
            MapSquare[i].addChild(MapLoader[i]);
            intDistCount++;
            intDistMultiplyX++;
            if (intDistCount > 26){
            intDistCount = 0;
            intDistMultiplyX = 0;
            intDistMultiplyY++;
    stage.addEventListener(MouseEvent.CLICK, reportClick);
    function reportClick(event:MouseEvent):void
        trace("movieClip Instance Name = " + event.target.name);   
    Now all this works fine, it creates the map and assigns the correct picture and places them in the correct X,Y position and it is the correct grid of 27x27 squares. The problem is with the name, when I click on the movie clip, it returns "Instance2" or "Instance5" or whatever. It starts with 2 and then increases each number by 3 for each clip, so the first one is 2, then 5 then 8 and so on. This is no good. I need it to return the name that I assigned it
    . If I put the code in trace(MapSquare[1]) it will return the name "MapSquare1" so I know the name was assigned, but it isnt returning.
    Please assist
    Thanks,
    -red

    Thanks for the resopnse,
    I know I dont really need the name, I just need the index number of the array, but I cant figure out how to get the index name without specificaly coding for it. That is why in the listener event I use event.target.name because I dont know what movie clip is being clicked until it has been clicked on. Basically when a movie clip is clicked it needs to return which index of the array was clicked.
    I could do it this way:
    MapSquare[0].addEventListener(
      MouseEvent.MOUSE_UP,
      function(evt:MouseEvent):void {
        trace("I've been clicked!");
    MapSquare[1].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    MapSquare[2].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    ... ect
    but that is unreasonable and it kind of defeats the purpose of having the array in the first place. The code that each movie clip executes is the same, eventualy that index will be passed into a database and the data at that primary key will be retrieved and returned to the program. So I just need to know, when one of those buttons is clicked, which one was clicked and what is its index in the array.
    I am a VB programer and in VB this is very easy, the control array automatically sends its own index into the function when one of the buttons is clicked. It seems simple enough, I just dont know how to do it in action script.
    Thanks again,
    -red

  • Need help getting files names from directory

    I have never done anything in php before and I'm struggling.
    In an attempt to search through potential document names in a directory, I've added the following code to a new php document:
    <?php
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "$file\n";
        closedir($handle);
    ?>
    with no luck. When executed all I get is a blank screen. Any ideas why?
    End goal is to list the file names in the directory so that the user can choose to open desired document. Thanks!

    Click here and pick the option which best fits your situation.
    (93771)

  • Need Space Between Firstname and Last Name

    Hi I am using Concat to Join First name and last name,But i need space in between...

    CONCAT("Users"."First Name",' ',"Users"."Last Name")
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27002] Near <,>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: SELECT CONCAT("Users"."First Name",' ',"Users"."Last Name") FROM "Usage Tracking"
    I am getting this..

  • In Infopath - From User Group webservice First & Last Name are not displaying

    Hi, I am working on Internet faced Infopath Sharepoint 2010 web application.In Infopath form we used a User Group web service to retrieve the first and last names when opening the form. In Development environment its working fine (Ex:- http://sharepoint2010dev:45/)
    then we extend the webapplication with domain name in url.(Ex:http://Domainsp:80/) then the first and last names from User Groups is not working.
    Please give your suggestions to resolve this isssue.
    Any help is appreciated..!

    Hi,
    According to your post, my understanding is that the User Group web service not worked when extend the web application with a domain name in URL.
    Did you change the URL to the UserGroup web service in the Data Connection Wizard?
    As you had changed the URL, I think you should change the URL(http://<site>/_vti_bin/UserGroup.asmx), then check whether it works.
    http://blog.ianchivers.com/2011/01/using-sharepoint-usergroup-web-service.html
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Address Book is adding last name. I need it to stop. Help?

    I am getting contacts in my address book saying stuff like "Joe Smith Smith" I don't utilize last names for personal preference reasons but it seems that the app is adding them anyway. Please help me find a way to stop them.

    Found this and it seems to be working for me on OS X 10.8.3...
    Junto26 
    Re: Address Book keeps changing the name of my contact     Dec 14, 2011 9:11 AM    (in response to fshelleyiv) 
    Hopefully you fixed it before now.  But if not, I had the same exact problem and I found a fix on MacRumors:
    Steps:
    1. Quit Mail
    2. Open Finder and go to Library ==> Application Support ==> AddressBook
    3. Remove the file MailRecents-v4.abcdmr
    4. Open Mail, the file will be created again but now the sync issues should be resolved
    This will stop that last name from re-adding itself even after you manually delete it.

  • How to remove mandatory field for Last Name in Personal Data Editing Screen

    Hello All,
    CUrrently we are using BP_ ERP5ESS1.31 SP5 & SAP_ESS  603 SP5.
    All my ESS Services are Displaying fine and working from Portal.I am having the requirement like I need to make Last Name as Non-Mandatory field in Personal Data. While Editing the PD Screen, there  i will find the * mark for Last Name filed, i checked through the Global Personalization Make as Mandatory is Not Personalized its showing, i think its defualt prpoerty,so i am unable make any changes from Portal w.r.t Global Personalization.
    I checked in SPRO-- Personal Admin> Custmomizing User Interfaces>Change Screen Modifications, there i find the respective Module pool for those Infotypes and country Specific..
    I cheked forModulePool MP000200--> P0002 and Variable Key-40(For India)  P0002 - NACHIN -- LastName only OF Radio Button is Selected all other Rado buttons are not selected.
    I Checked in V_T588MFPROPS view there for 0002 Infotype P0002 -- NACHN Mandatory check box is Checked all other check boxes are Unchecked.
    How to make that Last Name field as Non-Mandatory in Personal Data Edit Screen, where i need to make the changes.'
    Please list out the Steps..Where i need to do the configuration. And i assigned all the required ESS roles on the backend.
    Thanks in Advance
    Adapag

    Hi,
    I don't think supressing through Global Personalization will change the business logic. Within the Business Logic it checks for the mandatory field.
    After the changes I guess you need to make the changes accordingly.
    The below link might be of some help.
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?spaceKey=profile&title=ESSPersonalInformationUIenhancementwithoutmodification&decorator=printable
    Please correct if I am wrong.
    Cheers-
    Pramod

  • How to get userID or name from SSO, SSO Token

    How can I get the userID or name from the SSO token passed through a weblink/webtab to an external application?

    That's Simple...
    When you configure weblink or webtab you specify the custom application url along with SSO Token %%%SSO Token%%% similarly you can get User First Name, User Last Name, User Full Name and UserId from the same fashion..
    Hope this helps...
    Regards,
    Deepak H Andeli

  • Sqlldr - can you skip last row from a data file

    Hi
    I need to skip last line from the data file when I load the data into the tables. Is that possible to do using sqlldr, if yes How?
    Also, the first row in the data file, which has a single column needs to be loaded into all the rows of the table. How can i do that?
    Example
    020051213
    1088110 0047245 A 000000000000GB 00000496546700
    1088110 0719210 A 000000000000GB 00001643982200
    1088110 0727871 A 000000000000GB 00000083008900
    9010163
    The first line needs to go into all the rows, and the last row needs to be skipped. Remaining can be loaded normally. I think this would take multiple loads. Can anybody please help.
    TIA

    here i am sending a control file sample which use the when clause
    in sql loader
    load data
    infile 'load_4.dat'
    discardfile 'load_4.dsc'
    insert
    into table sql_loader_4_a
    when field_2 = 'Fruit'
    field_1 position(1) char(8),
    field_2 position(9) char(5)
    into table sql_loader_4_b
    when field_2 = 'City'
    field_1 position(1) char(8),
    field_2 position(9) char(5)
    )

Maybe you are looking for

  • Free goods should not determine in sales order

    Hi, I have maintained the free goods determination in SAP CRM with validity period in T Code: /sapcnd/gcm  and have created a quotation for the material which has a free goods validity.The free goods are determined at quotation level, when i was conv

  • Partition / Format - 500 gig Seagate external hard drive

    Alright, please correct me if I'm wrong. I just acquired a new 500 gig Seagate FreeAgent external hard drive. I want to format it so that all the files will be accessible/readable by both PC and Mac. It only needs to be write-able by a Mac (write-abl

  • Object Types--Link to business object in SBWP

    Hi All, In SBWP, there is an option under path Document>Create Attachment>Link to business object, in this list there is no Purchase Order,Purchase Requisition, Maintenance work order. Need to know how to add these business objects to this list. Than

  • Problem in Edit  Locally

    Hi,      I can't able to work with "Edit Locally" in my text file in the Public document. Can any body tell me,If i want to do any setting or adding any role ?...for enabling the  "Edit Locally" option in my public document. Regards, Ravi.

  • 10.4.4. and mySQL

    After updating to 10.4.4. I cannot connect to my local mysql server anymore, but get the old "#2002 - Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)" error again. I tried starting the database up manually through termi