Associating Data with a Control

When you use the Drag and Drop interface, controls that you draw on the screen are automatically associated with data items, usually from graphical Working-Storage or from a data set. You can also manually associate a value or variable with a screen control.

In the Screen Section, the VALUE property determines what data, if any, is associated with a given control. In the AcuBench Screen Designer, two Property window items are associated with this property. The Value property entry is used to set a fixed, initial value shown in the control when in the screen is displayed. The Value Variable property is used to tie the control to a variable data item, which may or may not contain a value when the screen is displayed. When these two properties are both set, the Value property is used to set the initial value for the specified Value Variable.

If you need to change the Exception Variable and the Exception Value, make sure that you change the Exception Variable first and then the Exception Value, because that might cause the Exception Variable to disappear from Working Storage.

To associate a variable with a control without using the Drag and Drop interface:

  1. In the Screen Designer, select a control on the screen form.
  2. Scroll through the Property window until all four value properties (Value, Value Multiple, Value Picture, and Value Variable) are visible.
  3. Click in the Value column of the Property window next to the Value Variable listing and do one of the following:
    • To create a new Working-Storage variable associated with the selected control, type a variable name in the field. When you tab or click away from the field, AcuBench automatically adds the new variable to graphical Working-Storage.
    • To select from a list of variables already assigned to other controls on the screen, expand the drop-down list and choose a value.
    • To select from a list of data items associated with your program’s data sets, graphical Working-Storage, and so on, click the browse (...) button and select an item from the interface.
  4. When you make an entry for the Value Variable property, the Value Picture property is updated to reflect the PICTURE clause associated with that variable.

    If you have entered a new variable name, a default value appears in this field. To change the value, click in the Value column next to the Value Picture property and enter a new value. AcuBench automatically updates the variable definition in graphical Working-Storage.

  5. If you want to set an initial value for the specified variable, click in the Value column for the Value property and enter the appropriate literal value.

If you select an entry field, for example, and assign a Value Variable property of ws-name, a Value Picture property of X(30), and a Value property of <Enter Name Here>, AcuBench generates the following code: