Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

If Or statement together

(1) ShareShare
ReportReport
Posted on by 71

Hi all,

 

So i'm trying to use an "If" together with an "Or" to get two possible outcomes below as to whether a button result can be edit or disabled, which doesn't seem to work. An invalid number of arguments, received one but expected 2 or more.

 

If(Or

(DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value <> Blank(),
 DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value = "Longer (please give comment)" && DataCardValue25.Value <> "",
    DisplayMode.Edit,
    DisplayMode.Disabled))
 
Any help would be greatly appreciated.
  • Steggsy17 Profile Picture
    71 on at
    Re: If Or statement together

    thanks @FLMike I can't believe that was a missing bracket, been a long day

    Appreciate the quick response

     

    thanks also @ANB for another solution, which I will look at too as I've not used the IsBlank function yet

    Appreciate the quick response

  • Michael E. Gernaey Profile Picture
    41,311 Super User 2025 Season 1 on at
    Re: If Or statement together

    Hi @Steggsy17  if my post solved your issue if you can mark it as such please. using the Accept as solution

    Thanks

     

  • Verified answer
    Michael E. Gernaey Profile Picture
    41,311 Super User 2025 Season 1 on at
    Re: If Or statement together

    Hi @Steggsy17 

     

    The issue is you aren't closing your Or properly

    Yours
    
    If(Or
    (DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value <> Blank(),
     DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value = "Longer (please give comment)" && DataCardValue25.Value <> "",
     DisplayMode.Edit,
     DisplayMode.Disabled)
    )
    
    Mine
    If(Or
    (DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value <> Blank(),
     DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value = "Longer (please give comment)" && DataCardValue25.Value <> "") <== add ) here to close the Or,
     DisplayMode.Edit,
     DisplayMode.Disabled <== remove )
    )
    
    Clean 
    (DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value <> Blank(),
     DataCardValue5.Selected.Value <> Blank() && DataCardValue6.Selected.Value = "Longer (please give comment)" && DataCardValue25.Value <> ""),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: If Or statement together

    Hi @Steggsy17 Try this:

     

    If( 
     Or(
     And( 
     !IsBlank(DataCardValue5.Selected.Value) , 
     !IsBlank(DataCardValue6.Selected.Value)
     ),
     And(
     !IsBlank(DataCardValue5.Selected.Value) , 
     DataCardValue6.Selected.Value = "Longer (please give comment)" , 
     !IsBlank(DataCardValue25.Value)
     )
     ),
     DisplayMode.Edit,
     DisplayMode.Disabled
     )

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard