Question Triggers in Maint Purchase Order

estego12

New Member
Dears:

I'm programming a trigger which prevents the maintainer Purchase Order is left blank the credit terms, the problem is that it forces me to position myself in the field to assess, but pressing "F1" in any other field the validation is not work, I attached the code to see if I get help

DEF VAR prov2 AS CHAR.
ON F2, GO, TAB, LEAVE, ENTER ANYWHERE DO:
IF FRAME-NAME = 'b' AND
FRAME-FIELD = "po_cr_terms"
THEN DO:
prov2 = STRING(FRAME-FIELD).
IF prov2 = "" THEN DO:
{mfmsg04.i '"Debe seleccionar Terminos de Credito"' 3}
RETURN NO-APPLY.
END.
FIND FIRST ct_mstr NO-LOCK WHERE ct_domain = global_domain
AND ct_code = prov2
AND ct_desc = 'NO APLICA' NO-ERROR.
IF AVAIL ct_mstr THEN DO:
{mfmsg04.i '"Seleccione Un termino de Credito Valido"' 3}
RETURN NO-APPLY.
END.

END.


END.
 

ovf

Member
Dears:

I'm programming a trigger which prevents the maintainer Purchase Order is left blank the credit terms, the problem is that it forces me to position myself in the field to assess, but pressing "F1" in any other field the validation is not work, I attached the code to see if I get help

DEF VAR prov2 AS CHAR.
ON F2, GO, TAB, LEAVE, ENTER ANYWHERE DO:
IF FRAME-NAME = 'b' AND
FRAME-FIELD = "po_cr_terms"
THEN DO:
prov2 = STRING(FRAME-FIELD).
IF prov2 = "" THEN DO:
{mfmsg04.i '"Debe seleccionar Terminos de Credito"' 3}
RETURN NO-APPLY.
END.
FIND FIRST ct_mstr NO-LOCK WHERE ct_domain = global_domain
AND ct_code = prov2
AND ct_desc = 'NO APLICA' NO-ERROR.
IF AVAIL ct_mstr THEN DO:
{mfmsg04.i '"Seleccione Un termino de Credito Valido"' 3}
RETURN NO-APPLY.
END.

END.


END.

Hi I would use the following logic:

ON "GO" ANYWHERE
do:
if can-query(self, "frame-name") and self:frame-name = "b" then
do:
widget-walk, and validate, if validation fails:
do:
message "fail message". /*use QAD message include */
return no-apply.
end.
end.
 
Top