AnsweredAssumed Answered

GEL String Functions - need "instr" or "Mid" function

Question asked by Lowell on Nov 28, 2011
Latest reply on Nov 30, 2011 by Lowell
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.

Outcomes