Kbase 18434: ADM2. Using Column Validation With SmartDataObjects (SDO)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
GOAL:
How to implement a column validation procedure in a SmartDataObject (SDO) using columnnameValidate
FACT(s) (Environment):
Progress ADM2
Progress 9.x
FIX:
Column validation procedures are created as internal procedures in
the SmartDataObject with a naming convention of columnnameValidate.
The submitRow function in super procedure data.p will run a
procedure for a column's name with "Validate" appended to it
for all columns that a user has modified in a visualization.
The internal procedure takes an input parameter which is a character
value. If validation fails, the internal procedure needs to return
a value which is displayed to the user as the error and focus will
be applied to the field in error in the visualization.
This example will create validation for the OrderLine.Qty field
which will ensure that the value entered for the order line
quantity is greater than zero.
1) Create a SmartDataObject for OrderLine table in the sports2000
sample database.
2) Create a SmartDataViewer for the OrderLine table using the
SmartDataObject created in step #1 as its Data Source.
3) Drop the SmartDataObject and SmartDataViewer onto a SmartWindow
and link them with Data and Update links.
4) Drop a Navigation SmartPanel onto the SmartWindow and link it
to the SmartDataObject with a Navigation link.
5) Drop an Update SmartPanel onto the SmartWindow and link it to
the SmartDataViewer with a TableIO link.
6) Create an internal procedure in the SmartDataObject called
QtyValidate with the following code:
DEFINE INPUT PARAMETER valqty AS CHARACTER NO-UNDO.
IF INTEGER(valqty) = 0 THEN RETURN
"Order Line quantity must be greater than zero".
END PROCEDURE.
If a quantity of zero is entered for the order line quantity, the
user will receive the following error:
"Field:Qty
Order Line quantity must be greater than zero"
and the quantity field will have focus in the SmartDataViewer.
Note that if the order line quantity has an initial value of
zero and the user does not modify the field in the visualization
this validation will not run.