Search code examples
microsoft-dynamicserpdynamics-business-centralmicrosoft-dynamics-nav

How to make sure only one boolean box is ticked at a time


I have a Boolean button where I want a user to only click or choose one. I am using Microsoft Dynamic Nav 2015.

enter image description here


Solution

  • In the OnValidate() trigger on the page field, create a local variable of the record and do something like this; it will set all other votes to FALSE when you set one to TRUE:

    IF Vote = TRUE THEN BEGIN
        theRec.SETRANGE(Vote, TRUE);
        IF NOT theRec.ISEMPTY THEN
            IF theRec.FINDSET THEN
                REPEAT
                    theRec.VALIDATE(Vote, FALSE);
                    theRec.MODIFY(TRUE);
                UNTIL theRec.NEXT = 0;
    END;