Truncate column with phone number

  • Hi all,

    I work on a package and I should want truncate a column with Phone number.

    example

    Input : +33049505059500 00 00 00 00

    And in output I want 0495050595.

    For this truncate, I use a "Deriver column" with a Conditionnal.

    For the moment I have this :

    LEN([Data Conversion 1].[Nº de tél. principal]) == 28 ? RIGHT(REVERSE(RIGHT([Data Conversion 1].[Nº de tél. principal],15)),3) : RIGHT([Data Conversion 1].[Nº de tél. principal],10)

    But it doesn't work.

    I don't have a LEFT fonctiun, and I have to play with REVERSE I think.

    Can you help me?

    Thanks

  • Use SUBSTRING instead of LEFT to achieve the same thing.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Thank Phil.

    I have already use this function, and I forgot to think at this function

  • mklein2 (2/15/2011)


    Thank Phil.

    I have already use this function, and I forgot to think at this function

    Just remember that a phone number can have no country code or a country code with 1 to 3 characters. Unless you have a country code list to compare to, you may be truncating at the wrong place.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply