QScript LogicalOr

From Q
Jump to navigation Jump to search

LogicalOr

Represents a LogicalOr object in a filter tree. At least one child condition must evaluate to true for this node to be true.

Used to combine multiple filter conditions where ANY can be satisfied. For example: "Age < 18 OR Age >= 65" (young or senior)

Create using DataFile.createLogicalOr and use with DataFile.newFilterQuestion.

Can be nested within LogicalAnd objects to create complex filtering logic like: (Condition1 OR Condition2) AND (Condition3 OR Condition4)

children

Gets an array of child filter nodes.

For FilterTerm objects (leaf nodes), this always returns an empty array.

For LogicalAnd objects and LogicalOr objects, returns the child conditions being combined.

equals(obj)

Whether two objects are the same.
objThe object to compare against.
Returns:true or false
Example:
data_file.getQuestionByName('Q2').equals(data_file.questions()[0])

label

Optional custom label for this filter node. If provided, this label may be used in the UI instead of the auto-generated description. Useful for providing human-readable names for complex filter conditions.

negated

Whether this filter node is negated (NOT logic applied). When true, the result of this node is inverted:
  • For FilterTerm object: matches become non-matches and vice versa
  • For LogicalAnd object: becomes NOT(A AND B AND ...) which is equivalent to (NOT A OR NOT B OR ...)
  • For LogicalOr object: becomes NOT(A OR B OR ...) which is equivalent to (NOT A AND NOT B AND ...)

type

Returns the name we use to refer to this class in the documentation.