Field Descriptors can be defined or modified in an Operation's properties using a FieldDescriptor property group. The FieldDescriptor property group will only affect the operation whose properties contain it.
Here is an example of what a FieldDescriptor property group might look like:
FieldDescriptor {
NAME: cname;
LABEL: Customer Name;
Association Operation: 1234;
}
This property group will modify the field descriptor for the CNAME field. Any time the CNAME field is used in the operation it will use the label and association operation set in the property group instead of its usual label and association operation. In general, you can set any property of the field descriptor by copying the label of the appropriate field from the FDManager into the property group. So to change the display rule for the field descriptor, you would add the property "Display Rule: Always;" to the property group.
All properties which are not set in the property group retain their original values from the default field descriptor. If a value is set in the default field descriptor and you want to remove that value in the property group, you can use the keyword “none”. For example, if an association operation is set in the default field descriptor for the field called “myField” you can use this property group to remove the association operation:
FieldDescriptor {
NAME: myField;
Association Operation: none;
}
If you want to hide the label for a field, you can use the keywords “_blank” or “_none”. When the label is set to _blank it will be rendered as an empty string, however there will still be an empty HTML table cell containing the blank label. When the label is set to the keyword _none, then WOW will not render the table cell for the label at all.
Debugging tip - If a property group modifies the FD for a field, then hovering over the field's FD gear icon will popup a window containing the property group.
Copying other field descriptors
The above example shows how to modify the default field descriptor for the CNAME field. It is also possible to modify a completely different field descriptor, and use that field descriptor for the CNAME field. This property group
FieldDescriptor {
NAME: cname;
ID: 789;
}
will have WOW use the field descriptor whose ID is 789 for the CNAME field. The default field descriptor for the CNAME field will be ignored. You can also modify the field descriptor by setting other properties in the property group:
FieldDescriptor {
NAME: cname;
ID: 789;
LABEL: Returning Customer;
Style Class: warn1;
}
This property group will use the field descriptor whose ID is 789 for the CNAME field, except it will have a different label and CSS class than field descriptor 789.
Creating new field descriptors
You can use the FieldDescriptor property group to create entirely new field descriptors in the operation properties. Assume that you have an existing operation whose SQL is
SELECT NAME, ACCOUNT, ADDRESS_TAB, HISTORY_TAB FROM LIB.TABLE
If you want to add a new tab to the results of this operation you could first modify the SQL to include the name of your new tab:
SELECT NAME, ACCOUNT, ADDRESS_TAB, HISTORY_TAB, NEW_TAB FROM LIB.TABLE
Then you can create the field descriptor for the new tab in the operation properties:
FieldDescriptor {
NAME: NEW_TAB;
LABEL: My new tab;
Association Operation: 555;
}
This field descriptor will connect operation #555 to the new tab, whose label will be "My new tab". If this same tab will be shown in other operations, it may be better to create a field descriptor using FDManager (instead of using the operation properties) so the single FD will be available to any operation. If this tab will only be used in this operation, then it will be easier to define it in the operation properties without using FDManager.
Field descriptors for parameters
Field descriptors defined in properties can also be used an operation's parameters. If an operation has this SQL:
SELECT * FROM PJDATA.BLPMSTR WHERE MSMLOC = ?
Then you could modify the MSMLOC field descriptor in the operation properties, and the modified field descriptor would be used for the parameter:
FieldDescriptor {
NAME: MSMLOC;
LABEL: Service Location ID;
}
You can also create a new field descriptor in the properties for use in the parameters. In order to do this, you change the SQL prompt by appending the name of your new FD onto the question mark (without any spaces):
SELECT * FROM PJDATA.BLPMSTR WHERE MSMLOC = ?NEWFD
This tells WOW to use the NEWFD field descriptor when generating the prompt for the MSMLOC field. The NEWFD field descriptor should then be defined in the operation properties:
FieldDescriptor {
NAME: NEWFD;
LABEL: Service Location ID;
Possible Values Operation: 777;
}
Custom properties
You can define custom properties in the FieldDescriptor property group. For example:
FieldDescriptor {
NAME: cname;
ID: 789;
LABEL: Returning Customer;
Color: red;
Spin: up;
}
Here the Color and Spin properties are custom properties which WOW will ignore. These properties can be read from the property group in code and used for custom logic. To obtain the property group in code, you can use the FieldDescriptorRow.getCreationProperties method, which will return the PropertyGroup object which was used to create that field descriptor. Alternatively, you can get a list of all property groups for an Operation with the Operation.getRowPropertyGroups method, and then pass that list to the FieldDescriptorProperties.getPropertiesByName method, which will return the property group with a specific name.
Details/Parameters/Results
In some cases you may want a field to behave differently depending on whether the field is displayed in a details screen, a results table, or as a parameter. This can be done by appending the appropriate suffix onto the property names of the FieldDescriptor property group:
For example, the "label_d" property can be used to specify the label to use when a field is displayed in the details screen.
This property group uses property name suffixes to control its described field:
FieldDescriptor {
name: MYFIELD;
label: Load;
label_d: Service Load;
Possible Values Operation_r: 1234;
Possible Values Operation_p: 5678;
}
The field's label will be "Load", except on the details screen where it will be "Service Load". When the field is shown as a parameter it will use operation 5678 as its possible values operation, and when it is in a results table it will use operation 1234 as its possible values operation.
FieldDescriptor{}
Most properties used in the FieldDescriptor property group can be copy/pasted directly from the FieldDescriptor (FD) Manager. For example, name:; label:; Possible Values Operation:; Association Operation:;. All of these values have been copied directly from the FD Manager for the corresponding value. There are, however, a few extra properties that are not in the FD Manager that are available to use: