>How can I get each element in a field in to an array?
>
>The field schres has data such as SDE,EPY,CMA
>
>My select statement:
>Select schres From schtbld Where schwk = CTOD("04/18/04") And !Empty(schres) InTo Array sch_man_power
>
>yeilds the entire string as first element of array. I need SDE as first element, EPY as second element, and so on.
>
>Thanks for help
Just exercising the alternatives :)
Assuming that there may be multiple records in the result set, any number of codes in the field, but all the codes have three characters:
DIMENSION laValues[1]
lcfields = ""
SELECT MAX(GETWORDCOUNT(schres, ",")) FROM schtbld INTO ARRAY acount1
FOR N = 1 TO acount1[1]
lcfields = lcfields + " PADR(GETWORDNUM(field1," + TRANSFORM(N) + ", ','), 3,' ')" +;
IIF(N < acount1[1], ',','')
ENDFOR
SELECT &lcfields FROM schtbld WHERE... INTO ARRAY laValues
However, you should deal with possible empty elements.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison