Skip to main content

Notifications

Community site session details

Community site session details

Session Id : U5odxejCa/X5Es8pXykBhf
Power Apps - Building Power Apps
Answered

Looping through nested gallery checkboxes

Like (0) ShareShare
ReportReport
Posted on 15 Jan 2023 05:45:29 by 51

Hi,

I am making a survey app and I have made my own checkbox control using a gallery since one doesn't exist natively.

When the user saves/submits, I need to loop though all checkboxes within the galCheckbox_CS gallery, which is within the main galSurveyForm_CS gallery, and then save the properties to a new row in a collection when the checkbox is selected. 

 

However, the ForAll(galCheckbox_CS.AllItems As _item loop is not running. I have tried it inside and outside the collect function. I have replaced the collection contents with dummy data.  I have removed all other logic. It still will not work. 

Any help would be appreciated.

Thank you.

 

 

 

 

 

ForAll(galSurveyForm_CS.AllItems,

If(ThisRecord.QuestionType = "Checkbox" || ThisRecord.QuestionType = "CheckboxDynamic",
Collect(_SavedSurveyResponsesCollection_CS,
ForAll(galCheckbox_CS.AllItems As _item,
If(_item.chkCheckboxSelection_CS.Value,
{
ModifiedResponseID: locCurrentModifiedResponseID,
QuestionID: ThisRecord.QuestionID,
Response: _item.QuestionOptionText,
ResponseShort: _item.QuestionOptionShortText,
ResponseValue: _item.QuestionOptionValue,
ResponseEntryDate: _CurrentDateTime_CS,
ResponseID: locCurrentResponseID
}
)
)
))

 

 

 

 

Screenshot 2023-01-15 154639.png

  • Verified answer
    kris_cs1 Profile Picture
    51 on 15 Jan 2023 at 08:08:57
    Re: Looping through nested gallery checkboxes

    Actually, I found another post that said to add a label with CountRows(galCheckbox_CS.AllItems) within the parent gallery, which solved the issue. Definitely seems like a bug.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,751 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started