You could also use 2 "if" statements or the "switch" statement.
// 2 if statements:
if (this.rawValue == 0) {//SQ1
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
}
if (this.rawValue == 1) {//SD2
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
DropDownList2.addItem("Triple Occ", "2");
DropDownList2.addItem("Quad Occ", "3");
}
The "switch" statement:
switch( Str(this.rawValue) ) {
case "0": {//SQ1
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
break;
case "1": //SD2
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
DropDownList2.addItem("Triple Occ", "2");
DropDownList2.addItem("Quad Occ", "3");
break;
default:
// place any error messages here
break;
}
The advantage of the 'switch' statement is the avoidance of the hard to read nested "if" statements, executes the first block of code that meets the logical condition, allows the stacking of the "case" clause to allow the execution of a single block of code for many values, and that the "switch" statement can be configured to evaluate very complex logical relationships.