Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > C

CHOOSE (Short name: CHO)

Scroll Prev Top Next More

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. For assistance with building your CHOOSE commands, refer to the R:Choose Builder Plugin.

 

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 *.RTF, and R:BASE will display a pop-up list of all files in the specified directory with the .RTF 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. 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. Your WHERE Clause conditions can also pre-loaded into the WHERE Builder using the OPTION WHERE_CLAUSE parameter.

 

#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 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 WHERE.

 

ORDER BY clause

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

 

CHKBOX

Displays a menu that limits the number of selections the end user can make.

 

CHKSORT

Displays a menu that limits the number of selections the end user can make, with support to sort the selected results.

 

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 list box. The default is 10.

 

FORMATTED

Displays the CHOOSE box using a mono space font

 

Additional OPTION parameters

Additional parameters are available to increase the visual display of the CHOOSE window. To use the graphic CHOOSE Builder, choose "Utilities" > "Plugins" > "CHOOSE Builder" from the main menu bar. All OPTION parameters and values must be separated by the "|" (pipe) character.

 

Notes:

 

CHOOSE will always be displayed at the center of your screen, unless specified using the TOP nn LEFT nn parameters.

The resulting variable will always be TEXT

The resulting variable will be left justified without leading spaces.

The [F2] key is recognized when the CHOOSE is displayed and behaves similar to the [Enter] key. Instances to use [F2] would be if no items in the CHOOSE would apply, and the user does not wish to close the CHOOSE with [Esc]. The [F2] status can then be captured with the LASTKEY function for additional program control.

 

 

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

__ Do what you have to do here with the variable CustID

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

 

 

Example 7:

 

CLS

CHOOSE vWhere FOR #WHERE IN Customer +

OPTION THEMENAME R:BASE Rocks! +

|WHERE_CLAUSE WHERE CustState = 'CA' ORDER BY COMPANY

RETURN