cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
d3ell
Helper V
Helper V

Change Display mode of a button dependant on gallery data

I have a gallery which shows a list of items - It has a qty for each item.  Both of which are fed from a sharepoint list data source. I have inserted a text input within the gallery and I'm wanting the user to be able to choose how many they want to 'book in'.  I have set the text in the gallery item to turn red if the line item exceeds the qty of each item, but what im wanting to do is not allow the user to press the submit button if any of the rows from the gallery have a hgher booked in qty than qty of items.  I'm really struggling to think of what the formula for this would be? I have tried the below

 

 

 

 

If(Value(Gallery1.AllItems.TextInput3.Text) > Value(Gallery1.AllItems.EXQTY),DisplayMode.Disabled,DisplayMode.Edit)

 

 

 

However when you hover the mouse over the Textinput3.Text  it shows a table but each row says that "This data type is unsupported for evaluation".  - Is there a way to do this using text input fields?

 

Another option i have tried is to to limit the value that the user can put into the text box. i have used this onchange function however when the user enters a value 2 high in one row of the gallery all rows get the "Showerrormessage" label which comes up within the gallery item.  - Is there a way to just have this only appear in the selected gallery item?

 

 

 

 

If(Value(TextInput3.Text)>ThisItem.EXQTY,UpdateContext({Showerrormessage:true});Reset(TextInput3),UpdateContext({Showerrormessage:false}))

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

To go through the Task, My Assumptions:

      GalleryName: Gallery1

      Column With Sharepoint Value: QuantityColumn

      Column For User Input: InputColumn

      Add another TextBox inside the Gallery: TextBox1 (You can later hide it)

 

Please ensure you change them to your Actual names

 

Let follow these steps:

  1. In the text property TextBox1 inside the Gallery1 put:

        If(ThisItem.QuantityColumn >ThisItem. InputColumn,"Valid","NotValid")

 

  1. Insert a Textbox2 outside the Gallery and on the Default put

          CountIf(Gallery1.AllItems,Subtitle1_1.Text="NotValid")

 

   3. Then On DisplayMode of your Submit Button:

     If(Value(Textbox2.Text)>0,DisplayMode.Disabled,DisplayMode.Edit)

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

3 REPLIES 3
Pstork1
Dual Super User III
Dual Super User III

The easiest way to do this is to create a variable of type integer and increment it each time a row exceeds the limit.  Then decrement it each time a row that exceeded the limit drops below the limit.  The formula for the button then is if the variable is greater than 0 disable the button.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Thanks for your input, and it sounds like a good idea, struggling to implement it though. Can you advise what the formula might look like? I can’t work out how to get the formula to run on each gallery item? Probably kick myself once I know, but struggling with this one.

Thanks in advance! 🙂
eka24
Super User III
Super User III

To go through the Task, My Assumptions:

      GalleryName: Gallery1

      Column With Sharepoint Value: QuantityColumn

      Column For User Input: InputColumn

      Add another TextBox inside the Gallery: TextBox1 (You can later hide it)

 

Please ensure you change them to your Actual names

 

Let follow these steps:

  1. In the text property TextBox1 inside the Gallery1 put:

        If(ThisItem.QuantityColumn >ThisItem. InputColumn,"Valid","NotValid")

 

  1. Insert a Textbox2 outside the Gallery and on the Default put

          CountIf(Gallery1.AllItems,Subtitle1_1.Text="NotValid")

 

   3. Then On DisplayMode of your Submit Button:

     If(Value(Textbox2.Text)>0,DisplayMode.Disabled,DisplayMode.Edit)

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,661)