Clearing variable's values

Overview

If a variable with a value is hidden or disabled, the value is retained.  Sometimes hidden or disabled variables are set through a dependency and only used in another part of the dependency.  In that scenario retaining the value of a hidden or disabled variable is needed.

Other times it is desirable to erase the value of a hidden or disabled variable.  That can be done in the dependency.

An example of how to erase the value of a hidden or disabled variable in a dependency

function main() {
  HideAndNull(#variable1.getControl(), #myVar1==0);
  HideAndNull(#variable2.getControl(), #myVar2==5);

}

function HideAndNull(control, condition) }
  control.show(condition);
  if (!condition) control.setValue(null);

}