True, I did miss a step. After the select there is:
if _tally > 0
lctemp[1] = lctemp[1] + 1
else
lctemp[1] = 1
endif
appe from array lctemp fields cod
But again, this is not the best way to go.
>select max(cod) from mytable ;
> into array lctemp
> lctemp[1] = lctemp[1] + 1
> appe from array lctemp fields cod
>
>If the table already contain data it works fine
>However it the table is empty, an operand/operator mismatch error appears
>
>Moises