<model> <mount>//OPNsense/FooBar</mount> <items> <dummies> <dummy type="ArrayField"> <value_a type="OptionField"> <OptionValues> <option1>Option No. 1</option1> <option2>Option No. 2</option2> <option3>Option No. 3</option3> </OptionValues> </value_a> <field1 type="TextField"> <Required>N</Required> </field1> <field2 type="TextField"> <Required>N</Required> </field2> </dummy> </dummies> </items></model>
<model> <mount>//OPNsense/FooBar</mount> <items> <dummies> <dummy type="ArrayField"> <value_a type="OptionField"> <OptionValues> <option1>Option No. 1</option1> <option2>Option No. 2</option2> <option3>Option No. 3</option3> </OptionValues> </value_a> <option1_field1 type="TextField"> <Required>N</Required> </option1_field1> <option2_field1 type="TextField"> <Required>N</Required> </option2_field1> <option2_field2 type="TextField"> <Required>N</Required> </option2_field2> <option3_field1 type="TextField"> <Required>N</Required> </option3_field1> <option3_field2 type="TextField"> <Required>N</Required> </option3_field2> <option3_field3 type="TextField"> <Required>N</Required> </option3_field3> </dummy> </dummies> </items></model>
FOREACH dummy IF value_a == 'option1' # option1 expects only input in "field1", drop other field RENAME field1 TO option1_field1 DELETE field2 ELIF value_a == 'option2' # option2 expects input in both fields RENAME field1 TO option2_field1 RENAME field2 TO option2_field2 ELIF value_a == 'option3' # option3: introduce a 3rd field RENAME field1 TO option3_field1 RENAME field2 TO option3_field2 CREATE option3_field3 WITH default_value ENDEND