Field binding is used to create a field to allow a value or response to be tied to an RPG program field. With field binding, a new field is created with the name, data type, and length associated with the bound field when the rich display file is compiled. The newly created fields are then able to be used in your RPG program to have a value or response set from the program itself, or to receive a value or response from the application.
If a field is able to be bound the field binding dialog button will be available in the property:
Clicking this button will open the Field Binding Dialog:
Formatting the Bound Field
There are many different types of formatting that can be applied to a bound field. This allows the data loaded into the field to be displayed in a certain format.
Text - Format used for text. Options here can have the spaces trimmed from leading or trailing spaces. Also allows for text to be right justified and have zero or blanks fill the field.
Number - Used to format numbers. Options here can use Thousands(1000) Separator or show zero balance of the field. And, also allows zero or blank fill for the field. No extra spaces causes an input field to behave as in keyboard shift Y. The number of characters that can be keyed into the field is equal to the length of the field. When no extra spaces option is unchecked, extra characters can be typed for the sign, decimal, and thousands separators.
In the example below you can see the differences between all options. The length of data is 10 and 2 decimals.
- For 1000 Separator the source data '1200000.00' would appear as '1,200,000.00' in the output.
- Show Zero Balance has source data '00' would appear as '.00' in the output.
- For Blank fill the source data '12.34 ' would appear as '12.34' in the output.
- For Zero fill the source data '12345.60' would appear as '00012345.60' in the output.
- For No Extra Spaces the source data ' 12345671.89' would appear as '12345671.89' in the output.
- Edit Word - Used to format a numeric field with an editing pattern you specify.
In the example above the source data '000000123' would appear as '****123.00' in the output.
- Edit Mask - Is used to block off certain characters so they cannot be changed in the input field.
In the example below the edit mask used in conjunction with the edit word property allows the '/' characters to not be removed when backspace or the delete key are used.
- Currency Symbol - Used to place a character or string representing currency to precede the data. For example '$', '€', or 'Dollars: '.
- Units - The units dropdown can preset the value of the field with a suffix from the following list:
Date - This is used to format the value of the field to display as a date.
Time - This format sets the value to display as a time. This can be set for 12 hour or 24 hour display.
Time Stamp - Formats the field with a date and time stamp in the selected format.
Special - These are presets formats designed for different scenarios, such as zip code, social security number, or phone number formats.
In this example the function determines if the value is greater than 50 it will append '19' to the front of the year, and '20' if not.
Custom Date/Time Pattern Example:
In the example you can see the pattern M - D - Y / g:i A would return the following format.