Clarity

  • 1.  GEL String Functions - need "instr" or "Mid" function

    Posted Nov 28, 2011 11:37 AM
    Hi All,
    I need to find the GEL "String" functions to fix a problem with my source data having "duplicates". I need to modify the "IDs" to include an extra character from the "Name" until the ID is unique.

    How do I write a loop to "add a character" to the ID of each until the "IDs of each record" are different?

    My data (as ugly as it is) has the following:

    Note: DIVID is the first 3 characters of the DIV
    SDIVID is the first 6 characters of SDIV

    DIVID DIV(Namelevel1) SDIVID SDIV
    HEA HEALTH INSURANCE SERVICES INSURA INSURANCE OPERATIONS
    HEA HEALTH INSURANCE SERVICES INSURA INSURANCE FRONT END


    I'm trying to find out how to get the "Length" of the SDIV value. Then, I want to "Add" a character from the ID on each pass to the SDIVID value. I don't see any "string" functions in the GEL libraries. Any clues to where these are?

    My initial solution would do something like the following:

    For example:
    Loop1:
    SDIVID SDIV
    INSURAN INSURANCE OPERATIONS
    INSURAN INSURANCE FRONT END

    Loop2:
    SDIVID SDIV
    INSURANC INSURANCE OPERATIONS
    INSURANC INSURANCE FRONT END

    Loop3:
    SDIVID SDIV
    INSURANCE INSURANCE OPERATIONS
    INSURANCE INSURANCE FRONT END

    Loop4:
    SDIVID SDIV
    INSURANCE INSURANCE OPERATIONS
    INSURANCE INSURANCE FRONT END

    Loop5:
    SDIVID SDIV
    INSURANCE O INSURANCE OPERATIONS
    INSURANCE F INSURANCE FRONT END

    Note: Loop5 has "unique" SDIVID values.


  • 2.  RE: GEL String Functions - need "instr" or "Mid" function
    Best Answer

    Posted Nov 29, 2011 03:58 PM
    To be able to use the string functions in GEL, you must use the substring method.
    then you can concatenate the values in the middle

    Something like

    <core:set value="${today.substring(11,12)}" var="runDate"/>
    <core:set value="${today.substring(12,19)}" var="runTime"/>
    Then you can do something like ${runDate} YourUniqueValue ${runTime}


  • 3.  RE: GEL String Functions - need "instr" or "Mid" function

    Posted Nov 30, 2011 07:27 AM
    Hi fpena,
    Thanks! - I have 1 more question: How do I get the "length" of a string?


  • 4.  Re: GEL String Functions - need "instr" or "Mid" function

    Posted Mar 07, 2019 06:01 AM

    I  hope Lowell found the answer time ago. But if someone else have the same question, here is the method  ${your_string.length()}