Skip to content
  • There are no suggestions because the search field is empty.

Filtering logic reference

This reference highlights how filters behave, their differences, and specific case sensitivities.

As a builder, understanding the behaviors of filtering logic across various features helps ensure data consistency and functionality. This reference highlights how filters behave, their differences, and specific case sensitivities.

1. Page component filters (Data table / Data list / Data container)

Use case: Filtering a Data container to display items where “Category contains ‘tech’”.

Behavior:

  • Case-insensitive: 'Tech' matches 'tech' and 'TECH'
  • Partial matches are valid (e.g., 'technology' matches 'tech')
  • Null or undefined values in the “Category” field are ignored

2. Page variables

Scenario: Assigning a variable value dynamically and using it for conditional rendering.

Behavior:

  • Equals operator: case-sensitive when comparing string values ('Foo' ≠ 'foo').
  • Handling null or undefined: null values often lead to conditional logic defaulting to false, ensuring no unintended data leakage.

Example: Prop value 'Foo' compared with null or "" (empty string) results in false.


3. Condition step (Actions)

Scenario: Using filters in actions for conditional execution.

Behavior:

  • Supports static, dynamic, and input variables as operands
  • Operators like Equals and Not equals are case-sensitive

Scenario: Filtering records in an action to execute only for items with “Priority greater than 3”.

Behavior:

  • Supports numeric comparisons, ensuring precision (e.g., 3.0 equals 3).
  • Null or missing priority values are treated as false for the condition.
  • Comparison operators like Greater than and Less than are not case-sensitive, as they operate on numeric or date types.

4. Action variables (object & collection)

Scenario: Filtering a collection to find items meeting a condition.

Behavior:

  • Operators like Contains and Starts with are case-insensitive.
  • Misaligned types (e.g., comparing a string with a number) throw errors.

5. Roles and permissions

Scenario: Allowing access to a dashboard only for users assigned the “Manager” role.

Behavior:

  • Role names are case-insensitive, so 'manager', 'Manager', and 'MANAGER' are treated equally.
  • Null or undefined role assignments result in access being denied.
  • Users with multiple roles are validated against all assigned roles for access.

6. Display logic: Box & Conditional components

Box component

Scenario: Display a component if the property value matches a condition.

Behavior:

  • Case-sensitive by default for string comparisons.
  • Filters may not display correctly if the string is mismatched in case (e.g., 'Foo' vs. 'foo' returns false).

Conditional display

Use case: Dynamically show or hide components based on user input.

Behavior:

  • Follows the Equals operator logic for string sensitivity.
  • Supports operators like Starts with, which are case-insensitive.

Key considerations across filters

  1. Case sensitivity: Always verify the case requirements of operators used.
  2. Null handling: NULL or empty strings are treated differently depending on the component or filter.
  3. Operator Differences: Certain operators like Contains might behave differently across features (case-insensitivity in lists but case-sensitivity in actions).

Example scenarios

Example 1: Data table filtering

Filter: Property 'Status' equals 'Active'.

Behavior:

  • Data table: Will not show items if the value is 'active' due to case sensitivity.

Example 2: Page variable in Conditional logic

Condition: Variable 'username' equals 'Admin'.

Outcome:

  • Matches Admin, but not admin or ADMIN.

Example 3: Display logic

Condition: Display box if 'Title' starts with 'Hello'.

Behavior:

  • Case-insensitive for Starts with: Matches 'hello world'.

Pages

Left hand side Operator Right hand side Display logic filter Page variables filter
"Foo" Equals "Fo" False False
"Foo" Equals "foo" True True
"Foo" Equals "Foo" True True
"Foo" Equals "" False False
"" Equals "Foo" False False
"" Equals "" True True
"" Equals NULL True  
NULL Equals "Fo" False False
NULL Equals "" True True
NULL Equals NULL True  
Left hand side Operator Right hand side Display logic filter
"Foo" Not equals "Fo" True
"Foo" Not equals "foo" False
"Foo" Not equals "Foo" False
"Foo" Not equals "" True
"Foo" Not equals NULL True
"" Not equals "Fo" True
"" Not equals "" False
"" Not equals NULL False
NULL Not equals "Fo" True
NULL Not equals "" False
NULL Not equals NULL False
Left hand side Operator Right hand side Display logic filter Page variables filter
"Foo" Starts with "Fo" True True
"Foo" Starts with "fo" True True
"Foo" Starts with "Foo" True True
"Foo" Starts with "" True True
"Foo" Starts with NULL True False
"" Starts with "Fo" False False
"" Starts with "" True True
"" Starts with NULL True False
NULL Starts with "Fo" False False
NULL Starts with "" True False
NULL Starts with NULL True  
Left hand side Operator Right hand side Display logic filter Page variables filter
"Foo" Ends with "Fo" False False
"Foo" Ends with   "oo" True True
"Foo" Ends with "oO" True True
"Foo" Ends with

"Foo"

True True
"Foo" Ends with "" True True
"Foo" Ends with NULL True  
"" Ends with "oo" False False
"" Ends with "" True True
"" Ends with NULL True  
NULL Ends with "Fo" False False
NULL Ends with "" True False
NULL Ends with NULL True  
Left hand side Operator Right hand side Display logic filter Page variables filter
"Foo" Contains “Fo” True True
"ABFoo" Contains “Fo” True True
"foo" Contains “Fo” True True
"Foo" Contains “fo” True True
"Foo" Contains “Foo” True True
"Foo" Contains "" True True
"Foo" Contains NULL True  
"" Contains “Fo” False False
"" Contains "" True True
"" Contains NULL True  
NULL Contains “Fo” False False
NULL Contains "" True False
NULL Contains NULL True  
"Foo" Contains String value: [a-zA-Z]{2} True True
"Foo" Contains String value: [a-zA-Z]{4} False False
"" Contains String value: [a-zA-Z]{2} False False
NULL Contains String value: [a-zA-Z]{2} False False
Left hand side Operator Right hand side Display logic filter Page variables filter
"Foo" Matches with “Fo” True True
"Foo" Matches with “fo” True True
"Foo" Matches with “Foo” True True
"Foo" Matches with "" True True
"Foo" Matches with NULL True  
"" Matches with “Fo” False False
"" Matches with "" True True
"" Matches with NULL True  
NULL Matches with “Fo” False False
NULL Matches with "" True True
NULL Matches with NULL True  
Left hand side Operator Right hand side Display logic filter
"Foo" Does not match "Fo" False
"Foo" Does not match "fo" False
"Foo" Does not match "Foo" False
"Foo" Does not match "" False
"Foo" Does not match NULL False
"" Does not match "Fo" True
"" Does not match "" False
"" Does not match NULL False
NULL Does not match "Fo" True
NULL Does not match "" False
NULL Does not match NULL False
Left hand side Operator Display logic filter Page variables filter
"Foo" Exists True True
"" Exists True True
NULL Exists False False
"Foo" Does not exist False False
"" Does not exist False False
NULL Does not exist True True

Actions

Left hand side Operator Right hand side Condition step filter  Variables
filter
"Foo" Equals "Fo" False False
"Foo" Equals "foo" True True
"Foo" Equals "Foo" True True
"Foo" Equals "" False False
"Foo" Equals NULL False False
"" Equals "Foo" False False
"" Equals "" True True
"" Equals NULL False False
NULL Equals "Fo" False False
NULL Equals "" False True
NULL Equals NULL True True
Left hand side Operator Right hand side Condition step filter 

Variables filter

"Foo" Starts with "Fo" True True
"Foo" Starts with "fo" True True
"Foo" Starts with "Foo" True True
"Foo" Starts with "" True True
"Foo" Starts with NULL   False
"" Starts with "Fo" False False
"" Starts with "" True True
"" Starts with NULL    
NULL Starts with "Fo" False False
NULL Starts with "" False False
NULL Starts with NULL False  
Left hand side Operator Right hand side Condition step filter  Variables filter
"Foo" Ends with "Fo" False False
"Foo" Ends with "oo" True True
"Foo" Ends with "oO" True True
"Foo" Ends with "Foo" True True
"Foo" Ends with "" True True
"Foo" Ends with NULL    
"" Ends with "oo" False False
"" Ends with "" True True
"" Ends with NULL    
NULL Ends with "Fo" False False
NULL Ends with "" False False
NULL Ends with NULL False  
Left hand side Operator Right hand side Condition step filter  Variables filter
"Foo" Contains "Fo" True True
"ABFoo" Contains "Fo" True True
"foo" Contains "Fo" True True
"Foo" Contains "fo" True True
"Foo" Contains "Foo" True True
"Foo" Contains "" True True
"Foo" Contains NULL False  
"" Contains "Fo" False False
"" Contains "" True True
"" Contains NULL False  
NULL Contains "Fo" False False
NULL Contains "" False False
NULL Contains NULL False  
"Foo" Contains String value: [a-zA-Z]{2}  True True
"Foo" Contains

String value: [a-zA-Z]{4} 

False False
"" Contains String value: [a-zA-Z]{2}  False False
NULL Contains String value: [a-zA-Z]{2}  False False
Left hand side Operator Right hand side Condition step filter  Variables filter
"Foo" Matches with "Fo" True True
"Foo" Matches with "fo" True True
"Foo" Matches with "Foo" True True
"Foo" Matches with "" True True
"Foo" Matches with NULL   True
"" Matches with "Fo" False False
"" Matches with "" True True
"" Matches with NULL    
NULL Matches with "Fo" False False
NULL Matches with "" False True
NULL Matches with NULL False  
Left hand side Operator Variables filter Variables filter
"Foo" exists True True
"" exists True True
NULL exists False False
"Foo" does not exist False False
"" does not exist False False
NULL does not exis True True

 

This reference serves as a guide to the filtering logic’s nuances, aiding in predictable and accurate implementation within Betty Blocks. For detailed technical nuances, refer to the developer documentation.