Parameter field conditions

A parameter condition is a strictly cosmetic effect that just makes form fields appear/dissapear in the task form. It is completely optional.

To define a condition for a certain parameter to follow, you can set the "Condition" key in the field's struct tag. The CFG for this syntax is as follows:

Condition           ::= equalityExpression
                      | compoundExpression
                      ;

equalityExpression  ::= "[" ParamName "," primitive "]"
                      ;

compoundExpression  ::= "[" ("$and" | "$or")
                        "," "[" Condition "," Condition { "," Condition } "]"
                      "]"
                      ;

Example

type Params struct {
	SomeModeParam     SomeMode
	SomeOtherParam    int

	SomeDependentParam    string `{"Condition": ["SomeModeParam", "mode1"]}`
	SomeANDDependentParam string `{"Condition": ["$and", [["SomeModeParam", "mode1"], ["SomeOtherParam", 1]]]}`
	SomeORDependentParam  string `{"Condition": ["$or", [["SomeModeParam", "mode1"], ["SomeOtherParam", 1]]]}`
}

Last updated