DO CASE CASE nNumber = 1 cOutPut = "Output string1" CASE nNumber = 2 cOutPut = "Output string2" CASE nNumber = 3 cOutPut = "Output string3" CASE nNumber = 4 cOutPut = "Output string4" .... ENDCASEwith the GETWORDNUM function you can do this:
cOutput = GETWORDNUM("Output string1~Output string1~Output string1~Output string1, nNumber, "~")which clearly save lots of coding and does not distract you from more important programming lines.
DO CASE CASE cVar = "X1" cOutPut = "Output string1" CASE cVar = "X2" cOutPut = "Output string2" CASE cVar = "X3" cOutPut = "Output string3" CASE cVar = "X4" cOutPut = "Output string4" .... ENDCASEWell then you could use something like this:
cOutput = GETWORDNUM("Output string1~Output string2~Output string3~Output string4, (AT(cVar,"X1 X2 X3 X4 ")+2)/3, "~")Also handy for filling arrays:
DIMENSION aArray[5,2] FOR nT = 1 TO 5 aArray[nT,1] = GETWORDNUM("Item 1~Item 2~Item 3~Item 4~Item 5",nT,"~") aArray[nT,2] = VAL(GETWORDNUM("1 2 3 4 5",nT)) ENDFORNot to mention decoding fields in delimited ASCII files or HL7 strings.