Formatting and Validating Data

DX lets you control formatting and input validation by setting resources instead of writing code.

The XmNformat resource controls how data should be displayed and interpreted using familiar printf-style specifications. These specifications support numeric, money, text and date/time formats in a wide variety of styles. and include complete support for internationalized applications.

All DBPak Data Presentation widgets perform basic validation against the format, and will not let users enter invalid data.

The Data Presentation widget XiDBDataField handles the display and entry of data as text. Within XiDBDataField, The XmNpicture resource setting specifies a picture for data entry in the widget. The picture is used to validate characters entered into the field.

The following table defines the characters you can use in a picture:

Character Definition
# Any numeric digit
? Case insensitive letter
& Uppercase letter (forces lowercase to uppercase )
@ Case insensitive character
! Uppercase character
; Interpret the following character literally
* Repeat the following character some some number of times
[] Characters within brackets are optional
{} Characters within braces are grouped
, Alternative values

Many other formatting and validation resource settings are available for the XiDBDataField widget, including XmNmaximum, XmNminimum, XmNmustFill and XmNnotifyPerKeystroke. By setting XmNautoReturnOnFill and XmNautoTraversal resources, you can also make the application behave like 3270-style data entry screens.

The XmNpictureFailedCallback resource specifies a list of callbacks to be called when users enter information that is invalid based on resource settings.

Additional Resources:

For a complete description of these and other resource settings for XiDBDataField:

  • Refer to XiDBDataField in DX HyperHelp.