The thing to remember is that the choose command is simply a SELECT
statement in disguise.
The select statement must return either one or two values, the second one
being the retcol value.

Also the value returned to the choose is always coerced into TEXT, so the
target variable must be  TEXT.

Before I create a choose command, I create and test a slect statement first.
That way, I will get  the correct error messages.  The ones returned from
choose can be VERY misleading.

SELECT (expression),(retexpression) FROM tblname WHERE clause ....

This will tell me if I will get what I want without errors.

Then I simply replace "SELECT" with "CHOOSE varname[, retcol] FROM #VALUES
FOR"
and tack on the "AT scrnrow scrncol ......" syntax

If the return value needs to be something other than TEXT, I assign it to
the correct type variable after returning from the CHOOSE
set var vDate DATE = NULL
set var vDate = &varname

This has greatly reduced my debugging time since I am debugging the SELECT
first, and then the CHOOSE.  I can focus my attention on the parts of the
command that are really suspect.

As you can see, the syntax diagram does not make it clear that you can have
expessions for both the display value AND the return value.  This lends
itself to some powerful processing possibilites.

Just remember the fact that CHOOSE is really a SELECT that populates a menu
and returns a TEXT representation of the selected menu expression or return
expression.

-- Dennis McGrath
mailto:[EMAIL PROTECTED]

-- Tools for R:BASE programmers
http://www.enteract.com/~mcgrath/dennis

-- Full time consultant with SQL Resources
mailto:[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Edwards Lucas
Sent: Sunday, April 28, 2002 10:37 PM
To: RBase user group (E-mail)
Subject: CHOOSE syntax


Please someone correct me here.
I'm assuming the syntax for CHOOSE is as follows:
CHOOSE varname FROM #VALUES FOR (expression),retcol FROM tblname WHERE
clause AT scrnrow scrncol TITLE 'title' CAPTION 'text' LINES n FORMATTED





================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to