local lnField, laFields[1], lcSelect, lcSQL lcSelect = '' select (cAlias) * get a list of the fields (except the last two) * if this isn't the first field in the list, add a <comma space> before adding the field name for lnField = 1 to afields(laFields) - 2 lcSelect = lcSelect + iif(empty(lcSelect), '', ', ') + laFields[lnField, 1] endfor * generate the SQL statement lcSQL = [SELECT ] + lcSelect + [ FROM (cAlias) ] + ; [WHERE ALLTRIM(USER_ID) = ALLTRIM(User) ] + ; [and alltrim(lettername) = alltrim(letters.lettername) ] + ; [into array RT_LETTR] * execute the SQL statement &lcSQL.For number two, just create an array 2 columns narrower and loop through, copying contents across:
select(cAlias) * get all of the fields into an array select * ; from (cAlias) ; where ALLTRIM(USER_ID) = ALLTRIM(User) and alltrim(lettername) = alltrim(letters.lettername) ; into array tempArray * create an array with the same number of rows, but with two fewer columns dimension RT_LETTR[alen(tempArray, 1), alen(tempArray, 2) - 2) * copy each element from the source array (less the last two columns) * to the corresponding element in the target array for lnRow = 1 to alen(tempArray, 1) for lnColumn = 1 to alen(tempArray, 2) - 2 RT_LETTR[row, column] = tempArray[row, column] endfor endfor * erase the (temporary) source array release tempArrayNote that I haven't had time to set up your environment to test this, so there may be a typo lurking somewhere - it should be enough to give you an idea or two though.