web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Set variable condition
Power Automate
Suggested Answer

Set variable condition

(1) ShareShare
ReportReport
Posted on by 49 Season of Giving Solutions 2025
Hi there,
 
Struggling to get my expression to work for this one. Any ideas?
 
Essentially, I have a variable 'contact type' which stores a text value and a compose which counts the number of rows from a list rows function.
 
If the value of the compose action is 1 or more, and contact type  DOES NOT equal student OR teacher I need the value to return as true 
 
if(
    and(
        equals(outputs('Compose_-_ABC_coms_memberships'), 1),
        or(
            not(contains(variables('contact type'), 'teacher')),
           not(contains(variables('contact type'), 'student'))
        )
    ),
    true,
    false
)

 
Categories:
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    try below :
     
    if(
        and(
            greaterOrEquals(outputs('Compose_-_ABC_coms_memberships'), 1),
            not(
                or(
                    contains(toLower(variables('contact type')), 'teacher'),
                    contains(toLower(variables('contact type')), 'student')
                )
            )
        ),
        true,
        false
    )
  • hpayne1993 Profile Picture
    49 Season of Giving Solutions 2025 on at
    @11manish thankyou! I'm now getting this error 
     
    Unable to process template language expressions in action 'Set_variable_-_eligible_for_PLG_rate' inputs at line '0' and column '0': 'The template language function 'greaterOrEquals' expects all of its parameters to be either integer or decimal numbers. Found invalid parameter types: 'Array'.'.
     
    I've converted the compose action to integer but this hasn't helped. any ideas?
     
     
  • 11manish Profile Picture
    3,333 on at
    greaterOrEquals() received an array instead of a number
     
    We can fix it by use of length() or empty() to evaluate the array
     
    Can you try below :
     
    and(
        greaterOrEquals(
            length(outputs('Compose_-_ABC_coms_memberships')),
            1
        ),
        not(
            or(
                contains(toLower(variables('contact type')), 'teacher'),
                contains(toLower(variables('contact type')), 'student')
            )
        )
    )
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,204 Super User 2026 Season 1 on at
     
    Try this:
    Use greaterOrEquals(outputs('Compose_-_ABC_coms_memberships'), 1) this instead.
    The fix is to swap or for and inside your not-contains checks.
     
    if(
    and(
    greaterOrEquals(outputs('Compose_-_ABC_coms_memberships'), 1),
    and(
    not(contains(variables('contact type'), 'teacher')),
    not(contains(variables('contact type'), 'student'))
    )
    ),
    true,
    false
    )
     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
     
  • hpayne1993 Profile Picture
    49 Season of Giving Solutions 2025 on at
    @11manish thankyou
     
    I am not receining an error anymore.
     
    Although it is now returning true when compose is 0. It should only be true when it is 1 or more 
  • Suggested answer
    Haque Profile Picture
    3,653 on at
    Hi @hpayne1993,
     
     
    You can try bit optimized one here:
    
    And(
        CountRows(outputs('Compose_-_ABC_coms_memberships')) >= 1,
        !Or(
            startsWith(toLower(variables('contact type')), "teacher"),
            startsWith(toLower(variables('contact type')), "student")
        )
    )
    
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard