Problem with filterByKey to group Items

Hi, I’m running into issues using filterByKey to group my items in a table. I’m showing data for different groups of students (“All Students”, “Students with Disabilities”, etc.) for 2900 schools. I want a table to show the different groups of students but always keeping the rows for each school together. It seems that filterByKey is the best approach. However, my data isn’t appearing when I think I have it correctly. Where am I going wrong? TIA!

Note: I thought I could post screen shots, but it’s not letting me? So, here’s my best explanation of the steps.

  • I’ve bound my first div to the list of schools in schools_leas.

  • I’ve bound the table collection list to my full data set, details_growth, using the filterByKey formula as I’ve understood it. filterByKey(details_growth, “school_name”, item.data)

  • Then I’ve bound my text fields to each variable in details_growth, which normally works without the filterByKey approach, but doesn’t show anything now.

  • Replacing item.data with item.data.school_name in the filterByKey also doesn’t work.

Note: I would try binding my first div to schools_leas.data but then my pagination doesn’t work, which leads it to crash.

Help appreciated!

Hello Savannah,

Apparently in the 3rd argument of the filterByKey function you should have a text value. This text value should be the name of the school you want to filter by, right?

Can’t you simply use the filter button below the formula input? You can bind dynamically the keys/values you want to filter by.

I see, you have the collection list selected. So, in that, all you need is the collection which I think here is “detail_growth.data”

after that add all the details you want into the list, like school_name for example. That would be added in the first “empty List” section.

after you add all the item_data values you want, you can set your filters under the collection list formula where is says “filter”

this will filter everything in the front end.

If you intend on having thousands of lines of data I would filter directly from the collection itself. When you do that its actually filtering before it pulls data from your backend making it much more efficient.

I hope this image makes sense, if not I can take some screen shots of my set up to help.

here I bind the collection list to the data collection I want to access the details from.

Inside that collection list I have a card. ( you only need 1 card, it will populate with amount of cards needed based on the amount of data in your collection.)

Inside each card I have all my item data. “name”, “position”, “address” etc.

Next I go back to the bind on the collection list and add my filters

I hope this helped. I believe there is a walkthrough on this in the academy.