Roger Blanchard
447 posts
Registered:
29 Jun 2018
21 Dec 2018
Link to this post
I have added Validation to a field using the Business Entity Designer. When the BE is created it has the following code in VaidateData.
@GeneratedValidationStart.
/* The following code is auto-generated. Don't insert custom code
between the @GeneratedValidationStart. and @GeneratedValidationEnd.
annotations as it would get overwritten when you update the Business
entity. */
FOR EACH eItem WHERE ROW-STATE (eItem) <> ROW-UNMODIFIED ON ERROR UNDO, THROW:
Consultingwerk.OERA.ValidationHelper:IsInRange (BUFFER eItem:HANDLE, "DeptNum":U, 1, 99, "A DeptNum must be between 1 and 99":U).
END .
@GeneratedValidationEnd.
If I needed to add addl validation where would I put it? In another FOR EACH eItem loop or just do not do this in the BE Designer? I need to make sure the selected codes for certain field have an associated record in another table. For example, I need to perform a CAN-FIND on the chosen Deptnum.
VALIDATE:CanFind(BUFFER eItem:HANDLE,
"DeptNum",
"Osprey.Pos.Dept.DeptBusinessEntity",
"eDept",
SUBSTITUTE ("FOR EACH eDept WHERE eDept.DeptNum = &1":U, eItem.DeptNum),
MessageFormatter:GetMessage("VALMSG":U, 2, "DeptNum")).