Skip to content

Advanced conditions and expressions in Power Automate

While basic conditional logic (IF X, THEN Y, ELSE Z) is fundamental for automating Tallyfy processes with Power Automate, many real-world scenarios require more nuanced decision-making. This article dives into advanced conditional techniques you can use with your Tallyfy data, including expressions, grouping conditions, and leveraging the Switch control to build sophisticated and responsive Tallyfy integrations.

Revisiting conditional logic

As covered in our article on using conditional logic in Power Automate, the Condition control is your primary tool for decision-making in flows that interact with Tallyfy. It evaluates whether a statement is true or false and directs the flow down different paths accordingly. Now, let’s explore how to make these conditions even more powerful when working with Tallyfy data.

Working with expressions in conditions

Power Automate expressions are formulas that allow you to manipulate data from Tallyfy (and other sources), perform calculations, and access specific properties of your dynamic content. When combined with conditions, they enable highly specific and flexible logic for your Tallyfy automations.

To use an expression:

  1. When configuring a condition (or any action field that accepts expressions), click inside the value box.
  2. The dynamic content pane will appear. Switch to the Expression tab.
  3. Type or select functions to build your expression.

Common expression functions relevant to conditions when working with Tallyfy data include:

  • String functions:
    • concat('string1', 'string2'): Joins strings.
    • substring('text', startIndex, length): Extracts part of a string.
    • toLower('TEXT') / toUpper('text'): Converts case (useful for case-insensitive comparisons of Tallyfy form field values).
    • equals('string1', 'string2'): Compares two strings (often used within an if expression for complex logic).
    • contains('text', 'searchText'): Checks if text contains specific searchText.
    • startsWith('text', 'searchText') / endsWith('text', 'searchText').
  • Date/Time functions:
    • utcNow(): Gets the current date and time in UTC.
    • addDays(timestamp, days, 'format'): Adds days to a date (e.g., calculating a new due date based on a Tallyfy task’s start date).
    • formatDateTime(timestamp, 'formatString'): Formats a date/time string (e.g., 'yyyy-MM-dd').
  • Conversion functions:
    • int('stringValue'): Converts a string (perhaps from a Tallyfy text form field) to an integer.
    • string(value): Converts a value to a string.
    • float('stringValue'): Converts a string to a floating-point number.
  • Logical functions (often used inside an if expression or directly in advanced mode):
    • if(condition, valueIfTrue, valueIfFalse)
    • and(condition1, condition2)
    • or(condition1, condition2)
    • not(condition)
    • empty(value): Checks if a value (string, array, object) is empty.
    • equals(value1, value2): Checks for equality.

Tallyfy example: Imagine a Tallyfy task has a due date stored as a text form field (e.g., TaskDueDateText). To check if this task is overdue in a Power Automate condition that interacts with Tallyfy:

  • Value 1 (Expression): formatDateTime(outputs('Get_task_details')?['body/forms/TaskDueDateText/value'], 'yyyy-MM-dd')
    • This assumes your Tallyfy due date text can be consistently formatted. You might need more robust parsing if formats from Tallyfy vary.
  • Operator: is less than
  • Value 2 (Expression): formatDateTime(utcNow(), 'yyyy-MM-dd')

Grouping conditions (AND/OR logic)

As mentioned in the basic conditions article, you can add multiple rows to a Condition control. You can also group these rows for more complex AND/OR logic when evaluating data from Tallyfy.

  1. Add multiple rows: Click + Add -> Add row within your condition.
  2. Select group: Check the boxes next to the condition rows you want to group.
  3. Make group: Click the ellipsis (…) on one of the selected rows and choose Make group.

You can then set an AND or OR operator for the conditions within that group, and also an AND or OR operator for how that group relates to other individual conditions or other groups at the same level, all potentially using data points from your Tallyfy processes or tasks.

Tallyfy example: Escalate a Tallyfy process IF: (Tallyfy process Name CONTAINS “Urgent” AND Priority form field IS “High”) OR (Days Overdue (calculated via expression) IS GREATER THAN 3)

Using the Switch control for multiple outcomes

If you find yourself creating many nested IF/ELSE conditions to check a single value from a Tallyfy form field against multiple distinct possibilities, the Switch control is a much cleaner and more manageable alternative in Power Automate.

  • Structure:
    1. Add a Switch control.
    2. On: Specify the value the Switch will evaluate (e.g., dynamic content from a Tallyfy form field).
    3. Case: For each possible value from your Tallyfy data, add a Case branch. In the Equals field of the Case, enter the specific value it should match.
    4. Place the actions for that specific case within its branch.
    5. Default: This branch executes if none of the preceding Case values match the “On” value from Tallyfy.

Tallyfy example: A Tallyfy task has a form field called “Request Type” with potential values: “Information,” “Access,” “Hardware.”

  • SWITCH ON: outputs('Get_task_details')?['body/forms/RequestType/value'] (This value comes from Tallyfy)
    • CASE Information:
      • Action: Send an email with links to relevant knowledge base articles.
    • CASE Access:
    • CASE Hardware:
    • DEFAULT:
      • Action: Notify IT support about an unclassified request from Tallyfy.

Advanced conditional patterns

  • Checking for null or empty values: Before trying to use a value from Tallyfy (especially optional form fields), it’s good practice to check if it’s empty or null to prevent flow errors. You can use the empty() expression in a condition:
    • Condition: empty(outputs('Get_task_details')?['body/forms/OptionalComment/value'])
    • Operator: is equal to
    • Value: true (expression)
  • Error handling (Brief Mention): While a full error handling discussion is for another article, you can use “Configure run after” settings on actions within your conditional branches to define what happens if a previous step fails. This allows you to build more resilient flows when automating Tallyfy tasks. More on this can be found in managing and monitoring Power Automate flows.

Best practices for advanced conditions with Tallyfy

  • Readability: Keep your expressions as clear as possible when processing Tallyfy data. For very complex logic, consider using a “Compose” action (detailed in working with data operations and variables) to build parts of an expression and see its output, then use the output of the Compose action in your condition. Since Power Automate lacks direct commenting for expressions, external documentation for complex Tallyfy-integrated flows is helpful.
  • Modularity: If conditional logic becomes extremely nested and hard to follow, consider breaking the flow into smaller, callable child flows (though this adds complexity in management and is a Power Automate specific feature).
  • Data type awareness: When comparing values, especially those from Tallyfy form fields (which might be text), ensure they are of the correct type for comparison or use conversion expressions (e.g., int(), float(), formatDateTime()).
  • Thorough testing: Test all possible paths of your conditions and switches. Use different Tallyfy data inputs to ensure every branch of logic is validated.

Power Automate > Using conditional logic in Power Automate

Power Automate uses conditional logic to evaluate Tallyfy data and execute different actions based on specific criteria allowing workflows to make automated decisions and adapt to various scenarios through IF/THEN/ELSE structures and Switch controls.

Automations > Logic operations explained

Tallyfy employs straightforward IF-THEN logic rules for automating workflow actions based on specific conditions that can be combined using AND/OR operators to create sophisticated business process automation.

Conditionals > Conditionals (IF) explained

Tallyfy’s automation system enables users to create conditional rules based on step status and form field values to automatically trigger actions in their workflows.