cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ishani_m
Frequent Visitor

Validation of controls in Gallery

I need to validate the control as required in Gallery couldn't make formula work for all rows. Please suggest the way to validate control for required value in each row and on what event it can work best when I add more rows on click of a button?

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@ishani_m 
I suggest you read this thread I responded to earlier in the week.  The other person was having exactly the same questions as you and we got it solved.


Link to post:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Gallery-message-if-one-item-does-not-meet-ce...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
mdevaney
Super User
Super User

@ishani_m 
I suggest you read this thread I responded to earlier in the week.  The other person was having exactly the same questions as you and we got it solved.


Link to post:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Gallery-message-if-one-item-does-not-meet-ce...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @ishani_m ,

Could you describe more clearly about the detailed Validation for the gallery?

How do you set the gallery?

If you want to Validate statically for each rows, you could directly use AddColumns function in the gallery items.

The AddColumns function adds a column to a table, and a formula defines the values in that column. Existing columns remain unmodified.

The formula is evaluated for each record of the table.

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping

 

If you want the Validation be triggered by a button, you could insert a label inside the gallery.

Use formula about Match function  and use "ThisItem.fieldname". It will evaluated for each record of the table.

Set the label's Text like this:

If(var,Match(...))

 Set the button's OnSelect:

Set(var,true)

Then when you click the button, the label will display the validation result.

Here's a doc about Match function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-ismatch

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@mdevaney I could reuse your method to make validation work in my case, on click of button. Thanks for the hrlp.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,766)