Text Default Options
A default property allows a data value to be generated automatically. For example, if you had two warehouses, one in Boston and the other in Sacramento, and wanted the user to default to the Sacramento Warehouse without having to scan a barcode or enter the code for the Sacramento warehouse, the developer of the application can set the default value to "Sacramento" so that when the user clicked on the prompt for the Warehouse, "Sacramento" would display.
A blank value means that there is no default.
Placing a ';O' (semicolon and the letter O, not zero) after the default parameter is optional, and allows the default to be overwritten.
Note: If using the VBA scripts, the Got_Focus event for a prompt contains a variable called ‘RSP’ which may be set to the value of the data default and a variable called ‘AllowChange’ (for overriding the value) which represents the value of the ‘;O’ expression; i.e., AllowChange = True, is the same as placing a ‘;O’ after the specified default property.
This will default the string value as entered. A string value can be any number, combination of letters, or special characters. Format is:
String value(;O)
Sacramento;O means default equals 'Sacramento', allow 'O'verwrite. Values contained in ( ) are optional.
This will default the current Windows system date in the format specified by 'exp1'. If no format is specified then the date will display using the format specified by the data item used for the prompt. Format is:
@DATE(;O)
@DATE;O means default equals current date displayed using MM/DD/YY format
This will default the current Windows system time using the format specified by the data item used for the prompt. Format is:
@TIME(;O)
@TIME(;O) means default equals current time
Translate Default - Displaying Data From Other Tables
This will extract data from another table; i.e., 'translate' the data. Format is:
@T,table,exp1,exp2,exp3,(exp4)(;O)
e.g.: @T,STATES,ID,3,NAM
Where:
Table is the name of a database 'translate table'.
exp1 is the column/field name for the translate table where indexed data is found.
exp2 is the current prompt number or column/field name where the key for the indexed table data (i.e., data to match on) can be found; value must be a number lower than the current category number.
exp3 is the column/field name for the translate table which contains the data to be retrieved.
exp4 an optional expression used only if exp2 is an 'unlinked' textbox field (i.e., not a database field for which RFgen can determine a data type); leave blank if exp2 data is numeric; let exp4 be a single quote " ' " if exp2 data is a string.
@T,STATES,ID,3,NAM retrieves a state name from a table called STATES. Here ' ID' is an indexed column/field name for the STATES table, and 'NAM' is the column/field name that contains the state name. Data from the current application, in prompt '3', provides the value of ID to use for the indexed search of the STATES table
This will concatenate any items specified, and default the resulting string. Valid items are entry categories or items enclosed by quotes. Format is:
@C,exp1,exp2,...,expN(;O)
@C,4,5,6,'***' means default equals prompt '4' value, joined with the prompt '5' value, joined with the prompt '6' value, joined with the text string '***'. Since no ';O' is present, the data will be entered and the application will continue at the next prompt
Character String Extraction Default
This will allow the default to be a portion of a previously entered input. Format is:
@SE,exp1,exp2,exp3(;O)
Where:
exp1 = entry category for the extraction.
exp2 = starting position of character string.
exp3 = length of string.
@SE,3,4,5;O means default equals data entered at prompt '3', starting at the '4'th character, and continuing for '5' characters
This will allow the default to be the result of an on-line calculation. Calculations may be performed using previously entered entry categories. Calculations are performed from left to right, and only arithmetic data is allowed. Format is:
@=calculation(;O)(;precision 'n') n=0 to 4
Where:
+ = addition
- = subtraction
* = multiplication
/ = division
@=6+7*"1.5";;2 means default equals the result of adding data from prompt '6' and '7', then multiplying the result by '1.5', and displayed using '2' decimal points.
All calculations are rounded to the precision selected after each calculation. If no precision is specified, then '4' decimal precision is used
Image Name Retrieval
In the case image controls, the Defaults property is filled in with the name of the image resource that has been loaded into the prompt.
This will default the last/prior data value, entered in the previous use of this prompt. If the default value is empty then the AllowChange parameter will be ignored. Thus a default of “@Last” will stop and allow input on the first pass and skip the field on all subsequent passes. The intended behavior of “@Last” is to maintain the last entered value until the application is exited.
Format is:
@LAST(;O)
Lists (Listing Choices) Default
This default is used to list multiple specific choices, from which 1 item may be selected. Items selected appear in a 'List' on the device. Format is:
@list,heading,item,item,item,item,…
Where 'heading' is the column heading name to print.
@list,Colors,RED,WHITE,BLUE allows the user to select 1 of the 3 colors
Skip the Current Entry Default
This default is used to conditionally skip the current prompt. Format is:
@SKIP,exp1,exp2,exp3
Conditional Operators (exp1,exp2,exp3) are:
exp1 = the prompt number
exp2 = a conditional operator from 1 of the following:
= for an equal to comparison
# for a not equal to comparison
> for greater than
< for less than
M for a matches comparison
nM for a not matches test
I: exp4 exists in exp2 (same as NC)
C: exp2 exists in exp4
NC: exp4 exists in exp2
exp3 = the prompt number or string value (in quotes) to match on.
@SKIP,2,=,'N' means to skip the current prompt if the data entered at prompt '2' equals 'N'.
Note in this example that exp1="2", exp2="=", and exp3="'N'"
This default is used to validate data before inserting the specified default value. Format is:
@Set,exp1,exp2,exp3,exp4
Conditional Operators (exp1,exp2,exp3,exp4) are:
exp1 = the value that will become the default
exp2 = the parameter to be compared to exp4. This can be a literal, a prompt number, or the RSP variable.
exp3 = a conditional operator from 1 of the following:
= for an equal to comparison
# for a not equal to comparison
> for greater than
< for less than
M for a matches comparison
nM for a not matches test
I: exp4 exists in exp2 (same as NC)
C: exp2 exists in exp4
NC: exp4 exists in exp2
exp4 = the second parameter to be compared to exp2. This parameter can be a literal or an edit such as NUM and ALPHA.
@Set,’Hello’,2,=,’100260’
This sets the default to ‘Hello’ if prompt 2 is equal to the string value 100620.
@Set,’Hello’,’XYZ’,#,ALPHA
This sets the default to ‘Hello’ if the string literal XYZ is not an ALPHA string. In this case, the default would never be used.
@Set,’Hello','3',C,'12345'
This sets the default to ‘Hello’ if the second parameter (3) is contained within the forth parameter (12345).
This default is used to develop multiple selection items from your database so that 1 may be selected. Format is:
@sql, statement
(where statement is a valid SQL select statement)
The heading that appears is the database column name.
@sql, select PONum from OpenPO would select the purchase orders numbers column, from open purchase orders table ‘OpenPO’.
A List, when used, clears the existing screen and lists selected data items (vertically) on the display screen. The RFgen ‘List’ display feature is a ‘full screen display’. The user then selects 1 of the items in the list. There are 3 examples of list creation which follow.
1. For predefined/known list box items use an ‘@list’ default:
@list,heading,item.1,item.2,item.3,…,item.n
Here: '@list,' indicates to RFgen that the statement is a 'default' parameter 'heading' is a name for the list that prints at the top of the box when it appears on a device 'item.1, item.2,…' are a listing of selection items to appear in the list.
e.g. - @list,Colors:,RED,WHITE,BLUE means to display a list with a heading of 'Colors:', and 3 selection items RED, WHITE, and BLUE to appear in the list.
2. For selection items which come from a database table, use an ‘@sql’ default:
An SQL statement as an application 'default property' (for the prompt that will use the list) may be used to select the necessary data from your database, as illustrated here:
@sql,select fieldname1 from tablename where fieldname2 ='%n'
Here: '@sql' indicates to RFgen that the statement is a 'default' parameter
'fieldname1' is the name of the table field/column to be displayed
'tablename' is the name of a database table which contains the fields/columns
'where fieldname2=' allows selection of certain data only
'%n' indicates data entered at prompt 'n' will be used for selection purposes.
@sql,select OrderNO from PObooks where PartNO ='%1' means to create a list box of order numbers from table 'PObooks' where the part number was entered at prompt number 1.
3. Alternatively, for database items, use a VBA script, e.g.:
Public Sub FieldName_GotFocus (Rsp As String, AllowChange As Boolean)
Dim SQL As String
SQL = "Select fieldname1 from tablename where
fieldname2 = '%n'"
Rsp = DB.MakeList(SQL)
AllowChange = True
End Sub
Here, the RFgen VBA extension ‘DB.MakeList’ is used in a GotFocus event to make a list from the results of the specified SQL statement. The results are passed to a prompt default variable named ‘Rsp’. A variable called AllowChange is set to True, meaning override allowed.
This default will put in the login name of the user. Format is:
@User