web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Checkbox default value...
Power Apps
Answered

Checkbox default value based on collection

(0) ShareShare
ReportReport
Posted on by 1,146

Thank you for taking the time to read my question.

 

I have a parent gallery with a nested horizontal gallery. The horizontal gallery has check boxes in it. The items for the horizontal gallery is a collection of 4 values. On Check adds a value to a different collection (colPrimaryFeedType), On Uncheck removes it from the collection (colPrimaryFeedType)

 

I then save the collection to a SQL table.

 

After I save the data to SQL, because the Items for the horizonal gallery is not the data selected, all the check boxes become unchecked. Therefore I'm using the following Lookup to try and "recheck" the check boxes so the user won't think the data was erased instead of saved. What I'm getting is that only one check box per parent gallery record is being checked instead of all instances.

 

If(LookUp(colPrimaryFeedType,Value(tBinID) = Value(lblBinID.Text)).tFeedType = ThisItem.FeedType,true,false)
//LookUp(colPrimaryFeedType,Value(tBinID) = Value(lblBinID.Text),true)

 

If the user selects Starter and Grower for Barn 1, Bin 1 and then saves, only Starter is checked with the uncommented formula above. I also tried the commented out formula, but everything is checked, even when adding records to colPrimaryFeedType.

 

DefaultValue.png

 

How do I get all the right check boxes checked?

 

Thanks

Categories:
I have the same question (0)
  • iwonder Profile Picture
    1,146 on at

    Thank you to all who viewed my question. 

     

    I'm still struggling to check all the check boxes in the horizonal gallery instead of just the first one in the list. Any help would be greatly appreciated.

     

    CheckBox.png

     

    Above:

    The gallery on the left is seen AFTER I have saved the records in galBin and galPrimaryFeedType to SQL. For Bin ID: 52 I only checked "Starter" which was saved to the collection seen on the right (put in a vertical gallery just to see the data collected) and was rechecked after the save. Bin ID: 53 I checked "Grower", "Finisher 1", "Finisher 2" but after the save using the following formula, only "Grower" is checked again.

     

    If(LookUp(colPrimaryFeedType,Value(tBinID) = Value(lblBinID.Text)).tFeedType = ThisItem.FeedType,true,false)

     

    How do I get "Finisher 1" and "Finisher 2" check boxes checked also?

     

    Thanks

  • Verified answer
    iwonder Profile Picture
    1,146 on at

    Got it figured out:

     

    If(ThisItem.FeedType in Filter(colPrimaryFeedType,tBinID = Value(lblBinID.Text)).tFeedType,true,false)

     

    LookUp only returns one record, I needed more than one record... not sure why I didn't realize that before. So I used Filter and In.

     

    Thanks

  • Mari Profile Picture
    Microsoft Employee on at

    Thanks for sharing your findings!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard