cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Check Box and Filtering to Collect a Database

 Hi, 

 

I have a large SQL database. 

I am using a Gallery and Checkbox  so users can select on 1 or Multiple items on the Checkbox to filter the database. 

The Checkbox is using a column called, "FilterColumn". 

Then the users select a button to Collect the data from the Database. 

 

Let's say the Checkbox is named FILTER

 

My function on Select in the Button is 

Collect(NEWDATABASE, Filter(SQLDATABASE,  FILTER.Text in FilterColumn)) 

 

When I look at the gallery, only 1 of the selected filters is collected. How can I make it so every selection is being filtered? 

 

Thank you, 

 

3 REPLIES 3
RandyHayes
Super User
Super User

@Anonymous 

Consider changing your formula to the following:

ForAll(
    Filter(yourGallery.AllItems, yourCheckBox.Value), 
    Collect(NEWDATABASE, LookUp(SQLDATABASE, FilterColumn = FILTER.Text)) 
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

@RandyHayes 

 

Doesn't ForAll() just loop the number of items that have been selected in the CheckBox? 

 

My SQL data is large so I have a column in there titled RECORDID, where each line has its own unique number from 1 to 200,000. 

The database was filtered by 2000 intervals ( RECORDID <        2000 ,  2000<=RECORDID   &&  RECORDID<4000 etc.) 

 

I tried to recreate your solution but because the number of data is large, it doesn't work. 

I then tried to add the Filter after the Lookup()

 

LookUp(Filter('SQLDATABASE', RECORDID <        2000), FILTERCOLUMN = FILTER.Text)) 

 

and this doesn't work either. 

 

@Anonymous 

I don't think I am understanding then what you have in the Gallery and where the checkboxes are. 

My impression was that you had a Gallery with items listed, you have users click on items they "want", and then at some point the user clicks a button and you wanted to collect those marked items?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,914)