Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Nested Gallery - Help Validating Required question is answered

Posted on 14 Dec 2024 20:48:17 by 11
Hi All,
 
I have a gallery with survey questions each of the questions are mandatory, based on the responses selected I am using a nested gallery inside the Parent gallery which becomes visible only if a certain response is selected in parent gallery. I need to add a validation that when all the questions are answered then only I submit button should be visible.I am able to do add this validation for Parent gallery but the same doesn't work for questions in nested gallery. Please help.
  • SH3R Profile Picture
    SH3R 11 on 15 Dec 2024 at 04:19:55
    Nested Gallery - Help Validating Required question is answered
    Hi WarrenBelz,
     
    I am using Radio button in Parent gallery and the visibility of Nested Gallery is dependent on the response select in Parent Gallery. The way I am handling the validation of Parent Gallery is similar to your approach, I have added a hidden label on Parent Gallery which has Text, Answered or Unanswered based on condition whether a response is selected in the gallery or not then on submit button I am doing a filter on ParentGallery.AllItems and checking for label values are not unanswered.
     
    I tried the same approach for nested gallery but the countrows was returning blank for Nested Gallery.Allitems so for troubleshooting I Saved gallery all items to a collection then I was able to get a value in CountRows but it was always showing Unanswered value for label even when on screen I could see everything as unanswered.
     
    I would try this approach to referencing the Unanswered and answered value on Parent Gallery for both Nested Gallery and Parent Gallery and then using it to filter on submit button. Thanks for the help, I'll let you know how it goes.
     
  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 14 Dec 2024 at 21:58:15
    Nested Gallery - Help Validating Required question is answered
    Hi @SH3R
    A bit messy (and watch for the order of resolution of the labels) and I am assuming checkboxes here (you will need the change the filter (blue part) depending on how you determine the child gallery complies) - but if you put a label inside the main gallery with
    If(
       ChildGallery.AllItemsCount = 
       CountRows(
          Filter(
             ChildGallery.AllItems,
             CheckboxName.Value
          )
       ),
       1,
       0
    )
    it will display the value 1 if all questions are answered (and zero if not). You then need a second label outside the gallery with
    Sum(
       ParentGallery.AllItems,
       Value(FirstLabelName.Text)
    )
    and then need to test for
    ParentGallery.AllItemsCount = Value(YourSecondLabel.Text)
    it should only be true if all questions are answered in the child galleries.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,595

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,098

Leaderboard