control of validity on a checkbox

DurandDurand Member Posts: 61
edited 2001-07-20 in Navision Financials
Hello, I look for an information concerning a control of validity on a checkbox (on form). Indeed,

OnDeactivateForm()
IF ("Budget saisi"<>TRUE) AND
("Planning de facturation"<>TRUE) AND
("Plan généré"<>TRUE) THEN
BEGIN
ERROR('Le projet n° %1 n''a pas de budget saisi ou planning de facturation ou de plan généré',"N°");
CurrForm.UPDATE(FALSE); //I use this syntax, but that does not work
END;

I make the test above and I shall wish that the focus returns on one of the checkbox tested. Could you indicate me the solution, thank you.

Comments

  • goofyfishgoofyfish Member Posts: 5
    Most form triggers will close the form if there is an error - you could move your code to the OnQueryCloseForm trigger. This will not prevent deactivation but it will at least prevent the closing of the form. You will not need the CurrForm.UPDATE portion, as the control focus will be on the last control entered by the user.

    Hope this is of some use to you.

    Rick

    [This message has been edited by goofyfish (edited 18-07-2001).]
  • mfabianmfabian Member Posts: 187
    First some words about propper coding:

    The statement:


    IF ("Budget saisi"<>TRUE) THEN

    can be replaced by

    If Not "Budget saisi"

    as the variable "Budget saisi" by itselfes is already a boolean variable containing a TRUE or FALSE.

    Therefore:
    ("Budget saisi"<>TRUE)
    is equal to
    ("Budget saisi"=FALSE)
    or
    (NOT "Budget saisi")


    According to the tautologies of De Morgan you can therefore replace:

    IF ("Budget saisi"<>TRUE) AND
    ("Planning de facturation"<>TRUE) AND
    ("Plan généré"<>TRUE) THEN

    with

    if Not (
    ("budget saisi" or "Planning de facturation" or "Plan généré")
    ) then


    If you issue an ERROR, all following statements will never be executed as the ERROR breaks all further processing.

    Therefore you might replace the ERROR with a MESSAGE in order to continue the processing. Thus:

    IF NOT (
    ("budget saisi" or "Planning de facturation" or "Plan généré")
    ) then Begin
    MESSAGE('Le projet n° %1 n''a pas de budget saisi ou planning de facturation ou de plan généré',"N°");
    CurrForm.UPDATE(FALSE);
    END;




    With best regards from Switzerland

    Marcus Fabian
    With best regards from Switzerland

    Marcus Fabian
Sign In or Register to comment.