function CarCodeToCarName >lparameter tcCarCode >local lcCarName >do case >case tcCarCode = 1 > lcCarName = "Ford" >case tcChevy > lcCarName = "Chevy" >case etc >otherwise > lcCarName = "Unknown" >endcase >*-- padr is necessary because the size of the field >* will be set by VFP based on the first record >* and we want it to be large enough to hold any value. >return padr(lcCarName, 20) >>
Lparam aArray, nRow if betw(nRow, 1, alen(aArray)) return(aArray[nRow]) else return '???' endifIn real life this also head some checking to see whether the array has one or two dimensions. Still, I didn't include the function in the SQL select, but rather included it in a report field, because of the speed and width issues.