> Thanks Razzak.  But when I use this coding I have a
> problem.  The varname in
> the CHOOSE command gives me a list of the selected
> items separated by
> comma's.  For example, empid is the retcol and I get
> (245, 257, 289).  How
> can I use this data to access the employee records
> for each of those that
> were selected?

There are two ways.  If you want to get all the
records in a single SQL command do:

SET VAR vIDList = '(' + .vIDList + ')'
SELECT * FROM YourTable WHERE IDColumn IN &vIDList

(Of course, you can use BROWSE, UPDATE, EDIT, etc).

Alternatively, if you want to get the records for each
of the IDs separately you need to do:

SET VAR vCounter = 1
WHILE (SSUB(.vIDList, .vCounter)) IS NOT NULL THEN
  SET VAR vThisID = ((SSUB(.vIDList, .vCounter))
  -- If IDColumn is a TEXT type
  SELECT * FROM YourTable WHERE IDColumn = .vThisID
  -- OR If IDColumn is an INT or other non-quoted type
  SELECT * FROM YourTable WHERE IDColumn = &vThisID
  SET VAR vCounter = (.vCounter + 1)
ENDIF

In this case, you DO NOT put parens on the vIDList
variable before use, as in the previous case.  Also,
notice the two different SELECT statements, depening
on whether IDColumn requires quotes for comparisons.
--
Larry

Reply via email to