ACCEPT command

Used to prompt users for information, which is then stored in a named variable, while the script is running.

Syntax

ACCEPT {message_text <FIELDS list_item_types> TO variable_name} <...n>

Parameters

message_text

The label displayed in the dialog box used to prompt for information. The value entered must be a quoted string or character variable.

FIELDS list_item_types

Optional. Specifies that the control in the dialog box should be a drop-down list instead of a text box. Use the list_item_types parameter to specify the item types to display in the drop-down list. The list_item_types parameter must be specified as a quoted string.

You can include one or more field name type (Table 1), one or more variable type (Table 2), or you can include multiple project item types (Table 3). You cannot mix field types, variable types, and project item types in the same ACCEPT command. The user can select a single value from the drop-down list.

TO variable_name

Specifies the name of the variable to use to store the user input. If the variable has a value assigned, it is displayed in the dialog box as the default value.

Table 1. Field drop-down list entries

List item

Item

C

Character fields

N

Numeric fields

L

Logical fields

D

Datetime fields

Table 2. Variable drop-down list entries

List item

Item

c

Character variables

n

Numeric variables

l

Logical variables

d

Datetime variables

Table 3. Project item drop-down list entries

List item

Item

xb

Scripts

xf

Tables

xi

Indexes

xr

Views and reports

xw

Workspaces

Remarks

The ACCEPT command is not supported in AX Server analytics, or in ACL Server Edition scripts.

You can use the ACCEPT command to create an interactive script. When the ACCEPT command is processed the script pauses and a dialog box is displayed that prompts the user for information that ACL uses in subsequent processing. You can create separate dialog boxes that prompt for information one item at a time, or you can create one dialog box that prompts for multiple items.

You cannot use the ACCEPT command inside the GROUP command. It is good practice to place all ACCEPT commands at the beginning of a script, where possible. If you ask for all input at the beginning, the script can then run unimpeded once the user enters the necessary information.

ACL stores the input in a character variable. If you need a numeric or datetime response, you can use the VALUE( ) or CTOD( ) functions to convert the character variable contents to numeric or datetime values. If you want to use the value of the variable as an ACLScript command or function parameter, you need to enclose the variable name in percent signs (%). The percent signs indicate that ACL must substitute the contents of the variable in place of the variable name.

Note

You cannot use non-English characters, such as é, in the names of variables that will be used in variable substitution. Variable names that contain non-English characters will cause the script to fail.

Examples

a. Prompting the user to select the ACL table to open.

The following example creates a dialog box that prompts the user to select the name of the table to open. The script then opens the table.

ACCEPT "Select the table to open:" FIELDS "xf" TO v_table_name
OPEN %v_table_name%

The percentage signs are required because they indicate to ACL that the table name to open is stored in the v_table_name variable. Otherwise, ACL will attempt to open an ACL table called “v_table_name”.

b. Using multiple dialog boxes to gather required information.

To create a single-prompt dialog box, use a single prompt string for each instance of the ACCEPT command. For example, this script generates separate prompts for a table name, a field on which to sample, a sampling interval, and a random start value:

ACCEPT "Enter the name of the table to analyze" TO v_table_name
OPEN %v_table_name%
ACCEPT "Select the field to sample" FIELDS "N" to v_field_to_sample
ACCEPT "Enter the sampling interval" TO v_sampling_interval
ACCEPT "Enter the random start value" TO v_random_start_value
SAMPLE ON %v_field_to_sample% INTERVAL v_sampling_interval FIXED v_random_start_value RECORD TO Sample_output

When the script runs:

c. Using a single dialog box with multiple prompts to gather required information.

You can use the ACCEPT command to prompt for multiple values in the same dialog box, by repeating the command parameters for each entry. You can separate the sets of command parameters with commas to improve readability, but it is not required. The following example prompts for both the username and password in the same dialog box:

ACCEPT "Username: " TO uid "Password: " TO pwd

Related reference
CTOD( ) function
VALUE( ) function


(C) 2015 ACL Services Ltd. All Rights Reserved.