> SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN (.vyears) 

Actually, R:Base will excuse you from the requirement for single quotes in an
IN clause.  It still won't work with a dotted variable, because R:Base is
(correctly) considering that to be a single value and trying to match the
entire string against the YEAR column.

What you really want to do is:

SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN (&vyears) 

which would substitute the string directly into the SQL statement. 
Unfortunately, this syntax has always confused the R:Base expression parser and
will generate an error.  The following, however, should work:

SET VAR vYears = '(' + .vYears + ')'
SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN &vYears

By including the parens in the variable itself you are able to reduce the
ambiguity and allow R:Base to process the expression.
--
Larry

Reply via email to