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 Apps / Help with Nestled if S...
Power Apps
Answered

Help with Nestled if Statement to disable, enable button

(0) ShareShare
ReportReport
Posted on by

Hi I have a canvas app and trying to enable disable a button called /Complete' on the button's display mode property with nestled if statement but button stays disabled.

 

So I have a field called CboTaskType. It's tied to an option set field, with values, Declaration, Endorsement and Policy.

I also have field called QCendTime tied to a Date and time Field

I have a gallery with items in them that each have a check box called CheckBox1.

 

What I need is, If the Task type is declaration and all the items in the gallery have their Checkbox1 ticked, then enable the button or disable it. This is the first if. This works if I keep it to this single if statement. However I need a second if statement to check that if the TaskType is either a Endorsement or Policy and the QC End Time isn't blank, then enable the button or else disable it.


My statement is as such
If(cboTaskType.Selected.Value = 'Task Type (Policy_bind_tasks)'.Declaration And
CountIf(Documentgallery.AllItems,Checkbox1.Value=false)>0,DisplayMode.Disabled,
cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Endorsement Or cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Policy And Not(IsBlank(QCendTime)),DisplayMode.Edit,DisplayMode.Disabled)

However the button stays disabled when task type is of Declaration and the gallery has all of its comboBox1 boxes checked.
The Endorsement or Policy statement part works- button is disabled for Policies and Endorsements if QCEnd time is bank, enabled when not.
Can someone help

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Darren137227 ,

    A few brackets here on the and/or combinations - you will need to check I have your logic correct.

    If(
     (
     cboTaskType.Selected.Value = 'Task Type (Policy_bind_tasks)'.Declaration &&
     CountRows(
     Filter(
     Documentgallery.AllItems,
     !Checkbox1.Value
     )
     ) = 0 
     ) ||
     (
     (
     cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Endorsement ||
     cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Policy
     ) && 
     !IsBlank(QCendTime),
     )
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

    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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Darren137227 ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

  • Darren137227 Profile Picture
    on at

    Hi Warren,

     

    I added your syntax but had some errors, so removed the two opening "( (" after the first || and removed
    the ")" after the .Policy and removed the ")" directly after (QCEndTime),

     

    So syntax is:
    If(
    (
    cboTaskType.Selected.Value = 'Task Type (Policy_bind_tasks)'.Declaration &&
    CountRows(
    Filter(
    Documentgallery.AllItems,
    !Checkbox1.Value
    )
    ) = 0
    ) ||


    cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Endorsement ||
    cboTaskType.Selected.Value='Task Type (Policy_bind_tasks)'.Policy
    &&
    !IsBlank(QCendTime), DisplayMode.Edit, DisplayMode.Disabled
    )

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard