Use the VIEW-AS phrase for data representation
- Last Updated: January 16, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
Many visual objects represent a single data value. This value can be a field from a database table or it can be a program variable. In both these cases, the default visual representation of the field is normally a fill-in field.
Why specify normally? You can define a visualization for a field when you create it as part of a database table definition in the Data Dictionary.
To see an example of how you define a field’s visualization:
- From the AppBuilder menu, select .
- From the Sports2020 database, select the Item table. This table holds information about the different sports-related items that customers can order from your business.
- Click the Fields icon and select the CatDescription field from the Fields list. This field contains the full description of an Item in the catalog.
- Click the Field Properties button.
- In the Field Properties dialog box, click the
View-As button.A dialog box appears where you can define a default visualization for a field if you want it to be an object other than a fill-in. In this case, there is a definition for the field:
The CatDescription field is defined to be viewed as an editor object, with a size of 41 characters by 5 lines and a vertical scrollbar. Whenever you select the CatDescription field and drop it onto a frame in the AppBuilder, the AVM automatically visualizes it as an editor of this description. If you define a variable to be
LIKEthe CatDescription field, it inherits these visual attributes along with the rest of the field description. You can change these attributes in your programs just as you can change the display for any other field, but the default is always to view it as an editor. - Cancel your way out of the dialog boxes and the Data Dictionary to return to the AppBuilder main window.
For all fields where there is no specific VIEW-AS definition in the Data
Dictionary, the default visualization is a fill-in field. If you want another
visualization of the field, you use a VIEW-AS phrase as part of the
object definition. There are several variations on this.
DEFINE VARIABLE statement, you can append the
VIEW-AS phrase to the definition:
|
The options are attributes for that visual type that you can choose, such as the
SIZE of the editor and the SCROLLBAR-VERTICAL
keyword.
If you are not defining a variable but simply placing a database field or other field
into a frame, then you append the VIEW-AS phrase to the name of the
field in the DEFINE FRAME statement, along with whatever options apply.
Here is an example from the frame definition the AppBuilder generates if you drop the
Customer Comments field onto a window and define it as an
editor, as you do later in the next section:
|