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 / Using Gallery Control ...
Power Apps
Answered

Using Gallery Control to trigger DisplayMode

(0) ShareShare
ReportReport
Posted on by 264

I have a trigger I'm using that's looking at the value of a gallery control / column to trigger the display mode of a button (STReportPrintBTN ), and it will only work for the first record of the gallery not the remaining records.  I have many similar triggers that are using the same method looking at a gallery of items and is successfully working, so I don't get it. 

 

One of the controls in the gallery named 'WOEstimate-JobNumber_2' (which is a text input) looks at the SP source ("Work Orders') list column 'Service Job Number'.  Pretty simple... if that sucker is blank in any of the gallery's records, then make my button's display mode disabled. Here's my code...

 

 

If(IsBlank('WOEstimate-JobNumber_2'),DisplayMode.Disabled,DisplayMode.Edit)

 

 

I have also attempted using different methods to write the code with no success.  

 

 

If(IsBlank(STReportGallery.AllItems.'WOEstimate-JobNumber_2'),DisplayMode.Disabled,DisplayMode.Edit)

If(IsBlank(STReportGallery.AllItems.'Service Job Number'),DisplayMode.Disabled,DisplayMode.Edit)

If('WOEstimate-JobNumber_2'.Text=Blank(),DisplayMode.Disabled,DisplayMode.Edit)

 

 

 As I mentioned, the code is not giving me the desired result outside of the first record.  Below you can see that I have many Yellow highlighted controls in multiple records that should be triggering the Button's Display Mode to be disabled, but it's not.  

 

Hours Report Display Mode.png

 

Can someone point out if I'm doing something wrong or if this is glitch?  Thanks.  

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @forbudt4u 

    Please consider changing your DisplayMode property Formula to the following:

    If(
     CountRows(Filter(STReportGallery.AllItems, IsBlank('WOEstimate-JobNumber_2'.Text)) > 0,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    I hope this is helpful for you.

  • forbudt4u Profile Picture
    264 on at

    @RandyHayes

     

    I tried this method with the control name, and it did not work.  However, when I replaced the control name with the source column name, it worked.  I also had to change it to a Value because it didn't like the text as part of the count for some reason.  Either way, I have it working.  Thanks for the solution!

     

    If(
     Value(CountRows(Filter(STReportGallery.AllItems,IsBlank('Service Job Number'))))=0,
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @forbudt4u 

    That formula may seem like it is working, but it is not providing what you originally were looking for.  In your post you were looking to only enable the button if there were no blank Text inputs in the gallery.

    If you use the column and not the text control, then it will not provide what you need.

     

    If you are basing the logic on the TextInput control, then it is that which you need in the formula.  The assumption was that the control name is 'WOEstimate-JobNumber_2' in which case it has a Text property that you would look at with the IsBlank function.

  • forbudt4u Profile Picture
    264 on at

    @RandyHayes 

     

    Sorry, I failed to mention that the default for the text input IS the source column value, and the OnChange property patches the source column when data is entered, so it will work.  I didn't reiterate that point below the additional expressions I was trying to use when I did attempt using the source column in them.  The main reason I want it to look at the source column is because that's what's important for the user to update, not just the local gallery.  I also have other controls this expression is looking at, I was trying to keep the post as basic as possible without going into the details of the parts that were actually working.  Sorry about not pointing that out.    

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @forbudt4u 

    No worries - just wanted to make sure you got a working formula!

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 Apps

#1
Valantis Profile Picture

Valantis 431

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 280 Super User 2026 Season 1

Last 30 days Overall leaderboard