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

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

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

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.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,838)