QScript LogicalAnd

From Q
Jump to navigation Jump to search

LogicalAnd

Represents a LogicalAnd object in a filter tree. All child conditions must evaluate to true for this node to be true.

Used to combine multiple filter conditions where ALL must be satisfied. For example: "Age >= 18 AND Gender = Male AND Income > 50000"

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

Can be nested within LogicalOr objects to create complex filtering logic like: (Condition1 AND Condition2) OR (Condition3 AND 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.