Difference between revisions of "Constraint: Compare Values"
| Line 1: | Line 1: | ||
| − | < | + | <pre class="header-style">This constraint allows or prevents a macro/feature from running based on a comparison between two values or variables.</pre> |
| − | + | ''' Options ''' | |
| − | + | * '''Compare Type''' - Indicates what type of comparison to perform from boolean, integer, decimal, string, array or dictionary. | |
| + | * '''Value1''' - The first value to compare | ||
| + | * '''Value2''' - The second value to compare | ||
| + | * '''Operator''' - Depends on the type of comparison (for example for string you can check if value1 contains value2, for integers you can compare if value1 is greater than value2) | ||
| + | |||
| + | ''' Example ''' | ||
| + | |||
| + | ''Example 1: Enable mobile data only when a usage flag is set'' | ||
| + | <pre class="trigger-style">Triggers | ||
| + | |||
| + | Screen On/Off - Screen On</pre> | ||
| + | <pre class="action-style">Actions | ||
| + | |||
| + | Mobile Data On/Off (Enable)</pre> | ||
| + | <pre class="constraint-style">Constraints | ||
| + | |||
| + | Compare Values - [data_allowed] = 1</pre> | ||
| + | |||
| + | ''' See Also ''' | ||
| + | |||
| + | * [[Action: Set Variable|Set Variable Action]] | ||
| + | * [[Constraint: MacroDroid Variable|MacroDroid Variable Constraint]] | ||
Latest revision as of 11:21, 9 January 2026
This constraint allows or prevents a macro/feature from running based on a comparison between two values or variables.
Options
- Compare Type - Indicates what type of comparison to perform from boolean, integer, decimal, string, array or dictionary.
- Value1 - The first value to compare
- Value2 - The second value to compare
- Operator - Depends on the type of comparison (for example for string you can check if value1 contains value2, for integers you can compare if value1 is greater than value2)
Example
Example 1: Enable mobile data only when a usage flag is set
Triggers Screen On/Off - Screen On
Actions Mobile Data On/Off (Enable)
Constraints Compare Values - [data_allowed] = 1
See Also