cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
forbudt4u
Resolver I
Resolver I

Using Gallery Control to trigger DisplayMode

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.  

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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
Super User
Super User

@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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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
Super User
Super User

@forbudt4u 

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

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,989)