Focal Point
[SOLVED] Extraction string before special character (slash)

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3787022196

April 10, 2019, 02:28 AM
Guilaine
[SOLVED] Extraction string before special character (slash)
Hello,
I 'm looking forward to extract the string before special character (slash)
Example : adF/France SAS
222/ kidle

  • adF/France SAS
  • 222/ kidle

    I would like only =>
    adf
    222

    WF V8.2

    This message has been edited. Last edited by: FP Mod Chuck,


  • WebFocus V8.2.03M
    April 10, 2019, 05:48 AM
    Frans
    -SET &PARAM = 'adF/France SAS';
    -SET &FIRSTTOKEN = TOKEN(&PARAM.QUOTEDSTRING,'/',1);
    -TYPE &FIRSTTOKEN  



    Test: WF 8.2
    Prod: WF 8.2
    DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
    April 10, 2019, 09:36 AM
    FP Mod Chuck
    Hi Guilaine

    Welcome to Focal Point I think you will find it an excellent forum for getting answers to your development questions..

    Frans example shows how to do this based on the value being in a parameter. It can also be done when the values are in a database field by using the DEFINE of the new field and using the TOKEN function and referencing the field with the slash.


    DEFINE FILE whatever
    NOSLASH/A10=TOKEN(SLASH_FIELD,'/',1);
    END



    Thank you for using Focal Point!

    Chuck Wolff - Focal Point Moderator
    WebFOCUS 7x and 8x, Windows, Linux All output Formats
    April 10, 2019, 01:31 PM
    NewBee...WF8
    Try the function GETTOK ;

    GETTOK(source_string, inlen, token_number, 'delim', outlen, output)


    WebFOCUS 8
    Windows, All Outputs
    April 10, 2019, 05:03 PM
    Waz
    Hi Guilaine,

    I would strongly suggest you check out the documentation on Functions.


    Waz...

    Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
    In Focus since 1984
    Pity the lost knowledge of an old programmer!

    April 11, 2019, 02:52 AM
    Guilaine
    Thank you everybody. with Fonction TOKEN : It's Good. Smiler


    WebFocus V8.2.03M