CHOOSE (Short name: CHO)
Top  Previous  Next

Use the CHOOSE command to display the following types of menus: bar with a pull-down, check-box, pop-up, sort check-box, vertical, or WHERE builder.

choose

Options

#COLUMNS IN tblview
Displays a pop_up menu containing all columns in the specified table or view and stores the chosen column name in the variable varname.

#DATABASE

Displays a pop_up menu containing all databases in the current directory, and stores the chosen database name in the variable varname.

#FORMS
Displays a pop_up menu containing all forms in the open database and stores the chosen form name in the variable varname.

#GLOBAL
Displays a pop_up menu containing currently defined global variables and stores the chosen variable name in the variable varname.

#LABELS
Displays a pop_up menu containing all labels in the open database and stores the chosen label name in the variable varname.

#LFILES IN filespec

Displays all files in the current directory in a pop_up list, unless the IN filespec option is specified. In this latter case, the user may specify a filespec such as *.MSG, and R:BASE will display a pop_up list of all files in the specified directory with the .MSG extension. The chosen file name is stored in the variable varname.

#LIST valuelist
Allows you to specify a list of values in a comma delimited format. You can also use a variable that contains comma delimited values in the command. The group of values MUST be encapsulated in quotes UNLESS a variable is used.

#REPORTS
Displays a pop_up menu containing all reports in the open database and stores the chosen report name in the variable varname.

#TABLES
Displays a pop_up menu containing all tables in the open database and stores the chosen table name in the variable varname.

#TBLVIEWS
Displays a pop_up menu containing all tables and views in the open database and stores the chosen table or view name in the variable varname.

#VIEWS
Displays a pop_up menu containing all views in the open database and stores the chosen view name in the variable varname.

#WHERE IN tblview
Opens the WHERE builder for you to enter conditions for the columns in the specified table or view; stores the entire WHERE clause in the variable varname.

menuname
A user_defined menu can be stored either in an ASCII disk file or as a menu block in an R:BASE procedure file created by CodeLock or the Application Designer. If procfile is used, menuname refers to a procfile menu block. If procfile is not used, menuname specifies an ASCII disk file containing the menu to be displayed.

#VALUES FOR
Displays a pop_up menu containing values from the specified column or expression and table. Use the (expression) option to display more than one column from the table in the menu, such as (colname1 & colname2).

DISTINCT
Suppresses the display of duplicate rows.

colname
Specifies a 1 to 18 character column name. In a command, you can enter #c, where #c is the column number shown when the columns are listed with the LIST TABLES command. In an SQL command, a column name can be preceded by a table or correlation name and a period (tblname.colname).

<expression>
Determines a value using a text or arithmetic formula. The expression can include other columns from the table, constant values, functions, or system variables such as #DATE, #TIME, and #PI.

,retcol
Specifies the column whose value is returned into the variable varname. The column does not have to be one of the columns displayed in the menu.

FROM tblname
Specifies the table name.

WHERE clause
Limits rows of data. For more information, see the WHERE command.

ORDER BY clause

Sorts rows of data. For more information, see the ORDER BY command.

CHKBOX
Displays a check_box menu.

CHKSORT
Displays a sort check_box menu

n
n is an optional positive integer specifying the maximum number of options on that menu that can be checked. If n is zero or is greater than the number of menu options, all options can be checked. If n is unspecified, the default value is zero. The maximum value of n is 9999.

TITLE 'title'
Displays a title in the dialog box.

CAPTION 'text'
Displays text in the dialog box title bar.

LINES n
Determines the number of lines, n, to display in the listbox. The default is 10.

FORMATTED
Displays the CHOOSE box using a monospace font.

OPTION parameters

This parameter can be used to change a "look and feel" of CHOOSE window.

All parameters for values must be separated by "|" (pipe) symbol. Following parameters are defined:

WINDOW_CAPTION - To customize window caption.  
 
Values:  
 
·OFF - makes window caption invisible.  
·SMALL - makes window caption small (tool window).  
 
TITLE_BACK_COLOR - To change background color of TITLE area. User can specify the integer value or type one of the predefined names:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 
TITLE_FONT_NAME - Specified a font name in title area.  
 
Values would consist of the fonts available on the computer.  
 
TITLE_FONT_SIZE - Specified a font size in title area.  
 
Values:  
 
·Integer value  
 
TITLE_FONT_COLOR - To change font color of TITLE area. User can specify the integer value or type one of the predefined names:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 
TITLE_BOLD - Makes font in title area bold style.  
 
Values:  
 
·ON  
·OFF  
 
TITLE_ITALIC - Changes font in title area italic style.  
 
Values:  
 
·ON  
·OFF  
 
TITLE_UNDERLINE - Changes font in title area underlined.  
 
Values:  
 
·ON  
·OFF  
 
TITLE_STRIKEOUT - Makes font in title area strikeout.  
 
Values:  
 
·ON  
·OFF  
 
LIST_BACK_COLOR - Changes background color of LIST area. User can specify the integer value or type one of the predefined names:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 
LIST_FONT_NAME - Specifies a font name in LIST area.  
 
Values would consist of the fonts available on the computer.  
 
LIST_FONT_SIZE - Specifies a font size in LIST area.  
 
Values:  
 
·Integer value  
 
LIST_FONT_COLOR - Changes font color of LIST area. User can specify the integer value or type one of the predefined names:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 
LIST_BOLD - Makes font in LIST area bold style.  
 
Values:  
 
·ON  
·OFF  
 
LIST_ITALIC - Makes font in title area italic style.  
 
Values:  
 
·ON  
·OFF  
 
LIST_UNDERLINE - Makes font in title area underlined.  
 
Values:  
 
·ON  
·OFF  
 
LIST_STRIKEOUT - Makes font in title area strikeout.  
 
Values:  
 
·ON  
·OFF  
 
WINDOW_BACK_COLOR - Changes color of WINDOW BACKGROUND area. User can specify the integer value or type one of the predefined name:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 
BUTTON_OK_CAPTION - Changes the caption for "OK" button.  
 
BUTTON_CANCEL_CAPTION - Changes the caption for "Cancel" button.  
 
BUTTONS_SHOW_GLYPH - ON Turns on images on OK and Cancel buttons.  
 
BUTTONS_BACK_COLOR - Changes the color of BUTTON area. User can specify the integer value or type one of the predefined names:  
 
Values:  
 
·AQUA  
·BLACK  
·BLUE  
·CREAM  
·DARK GRAY  
·FUCHSIA  
·GRAY  
·GREEN  
·LIME  
·LIGHT GRAY  
·MAROON  
·MEDIUM GRAY  
·MINT GREEN  
·NAVY  
·OLIVE  
·PURPLE  
·RED  
·SILVER  
·SKY BLUE  
·TEAL  
·WHITE  
·YELLOW  
 

TOP - will move the choose box location in pixels from the top of the screen down  

LEFT - will move the choose box location in pixels from the left of the screen down  
 
THEMENAME - Will dynamically provide over thirty pre-defined themes  
 
Values:  
 
·Deep Cyan  
·Deep Green  
·Deep Orange  
·Diamond Blue  
·Diamond Green  
·Funny Theme  
·Gnome  
·Green Glass  
·Longhorn  
·Mac OS  
·Matrix  
·Media  
·One Blue  
·One Clear Blue  
·One Cyan  
·One Green  
·One Orange  
·Orange Glass  
·R:BASE Rocks!  
·Razzmatazz  
·Real One  
·Sports Black  
·Sports Blue  
·Sports Cyan  
·Sports Green  
·Sports Orange  
·Steel Black  
·Steel Blue  
·Win Native  
·XP Blue  
·XP Egypt  
·XP Green  
·XP Grey Scale  
·XP Orange  
·XP Silver  

All previously defined CHOOSE commands which are redefined to use Themes should be thoroughly checked prior to putting into production as objects and text may look substantially different.


Example 1:


CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 01' LINES 20 FORMATTED
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
-- Do what you have to do here with the variable CustID
LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN


Example 2:


CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
CHKBOX 1 TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 02' LINES 20 FORMATTED
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
-- Do what you have to do here with the variable CustID
LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN


Example 3:

CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 03' LINES 20 FORMATTED +
OPTION List_Font_Color WHITE|List_Back_Color TEAL +
|Title_Font_Color TEAL|Title_Back_Color WHITE +
|Window_Back_Color WHITE|Title_Font_Size 24 +
|Title_Font_Name TIMES NEW ROMAN|Window_Caption
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
-- Do what you have to do here with the variable CustID
LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN


Example 4:


CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 04' LINES 20 FORMATTED +
OPTION List_Font_Color WHITE|List_Back_Color TEAL +
|Title_Font_Color TEAL|Title_Back_Color WHITE +
|Window_Back_Color WHITE|Title_Font_Size 24 +
|Title_Font_Name TIMES NEW ROMAN|Window_Caption
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
-- Do what you have to do here with the variable CustID
LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN


Example 05:


CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
CHKBOX 1 TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 05' LINES 20 FORMATTED +
OPTION List_Font_Color WHITE|List_Back_Color TEAL +
|Title_Font_Color TEAL|Title_Back_Color WHITE +
|Window_Back_Color WHITE|Title_Font_Size 24 +
|Title_Font_Name TIMES NEW ROMAN|Window_Caption +
|Buttons_Back_Color WHITE
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
--LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN


Example 6:

CLS
CHOOSE vCustIDTxt FROM #VALUES FOR +
(LJS(Company,40)&CustCity+','&CustState),CustID +
FROM Customer ORDER BY Company +
CHKBOX 1 TITLE 'Company Name and Location' +
CAPTION 'Colorful CHOOSE Example 06' LINES 20 FORMATTED +
OPTION List_Font_Color WHITE|List_Back_Color TEAL +
|Title_Font_Color TEAL|Title_Back_Color WHITE +
|Window_Back_Color WHITE|Title_Font_Size 24 +
|Title_Font_Name TIMES NEW ROMAN|Window_Caption +
|Buttons_Show_Glyph ON|Buttons_Back_Color WHITE
IF vCustIDTxt IS NULL OR vCustIDTxt = '[Esc]' THEN
   GOTO Done
ELSE
   SET VAR vCustID = .vCustIDTxt
ENDIF
-- Do what you have to do here with the variable CustID
LABEL Done
CLEAR VAR vCustIDTxt, vCustID
RETURN

Notes:

·CHOOSE will always be displayed at the center of your screen.  
·The resulting variable will always be TEXT  
·The resulting variable will be left justified without the leading spaces in variable, if any.