>>>Truthfully, there is no simple elegant approach for what Dmitry was looking for.
>
>The question posed 3 fields any of which may or not be present so the options are: (binary 1 for present, 0 for absent)
>
>111
>110
>101
>011
>100
>010
>001
>000
>
>IOW 8 options for 3 fields. IF isn't practical in the absence of ELSEIF so you'd need 8 CASE statements with 8 INSERT commands.
But VFP's CASE actually is ELSEIF (with implicit break after first hit).
>Increase the number of fields to 4,5,6... and soon you're into the hundreds of options.
Any conditional processing in such a case is a dangerous kludge which will break when a mouse farts. The gather in a function is actually the only simple and elegant solution that I saw here. Besides, there's no danger of overstepping any outside variables, as parameters always hide any variable with the same name existing in the caller or above. This has been so since the days of foxplus (learned that the hard way).