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

CountRows in data table with multiple comboboxes

Hello friends!

 

I'm new to PowerApps but am pretty code savvy (heavy Microsoft VBA background).  I have an app sheet with 10 comboboxes that help to filter data in a data table lower on the screen (source is 'tblMAINDATA' - a SP list).  The filter is working fine to update the data in the table, but I've created a label to show "XX records out of 115" and the XX is just not updating as expected.  If I select 1 combobox item, it's accurate, if I select a second one, it seems to be an "additive" answer and increase the count even when the table shows less matching results, rather than a count of the actual records that meet ALL criteria.  I seems to be pretty close, but I must be not accounting for an AND or OR condition to correctly get the total rows (or records) that match.

 

I've tried the second part of the code with both an AND and OR condition with no success.  

 

Here's what I have in the label as the "ITEM" formula:

 

CountRows(
Filter(
tblMAINDATA,
If(
!IsBlank(cboApproved.Selected.Result) &&
!IsBlank(cboActive.Selected.Result) &&
!IsBlank(cboFranchise.Selected.Result) &&
!IsBlank(cboCustomerFocusedArea.Selected.Result) &&
!IsBlank(cboDeviceTechnologyFunction.Selected.Result) &&
!IsBlank(cboOriginalManufacturer.Selected.Result) &&
!IsBlank(cboFDAProdCode.Selected.Result) &&
!IsBlank(cboFDAProdDescription.Selected.Result) &&
!IsBlank(cboDHFCode.Selected.Result) &&
!IsBlank(cboDeviceSpecificTradeName.Selected.Result),
"0",
cboApproved.Selected.Result = Approved,
cboActive.Selected.Result = Active,
cboFranchise.Selected.Result = Franchise,
cboCustomerFocusedArea.Selected.Result = CustomerFocusedArea,
cboDeviceTechnologyFunction.Selected.Result = DeviceTechnologyFunction,
cboOriginalManufacturer.Selected.Result = OriginalManufacturerOM,
cboFDAProdCode.Selected.Result = FDAProductCode,
cboFDAProdDescription.Selected.Result = FDAProductDescription,
cboDHFCode.Selected.Result = DHFCode,
cboDeviceSpecificTradeName.Selected.Result = DeviceSpecificTradeName
)
)
)

& " records out of " & CountRows(tblMAINDATA)

 

 

Thank you all in advance.

John

11 REPLIES 11
RandyHayes
Super User
Super User

@JScherff 

Well, it seems like a lot of steps, but it is well described in the instructions, so it should go quickly - and it will save you the conversion to the gallery.

The gallery is preferred over the datatable as you will have more control over it.  But, there is the price to pay that a gallery is an open slate - you need to add the controls and format as you need.  The datatable does have the slight advantage (and it is really only this that it has) of displaying data without having to define anything else.

 

You can use the datacard Update method I described and expand it as you want.  It is only a simple record with a single column for the datatable items.  It can have many other column that have many other formulas that will all evaluate dynamically as well.  I would recommend only one datacard per larger filter operation as, if they are combined, if one needs to re-evaluate its records, then the other will as well, and that can impact performance.  Something to always keep in mind.  

So, overall, it is just a choice of where you want to do the work that you need to do to get what you need.

_____________________________________________________________________________________
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!

Thanks Randy, appreciate the info.  Food for thought, definitely.  

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (2,467)