Unit 5 - Hackathon - dataset filter from multiple drop downs

Let me see if I can explain this…

One of the groups in my classroom, has created 3 drop downs (Rating, Type (movie, TV) and Country) and they are using the Netflix dataset. What they want to accomplish is being able to choose the rating (G, PG, PG-13, etc), the type (Movie, TV) and the country (Argentina, Bolivia, United States, etc.) and create a list of items from those filters. In other words, if they chose PG, Movie and United States, they would like to see a list of movies, showing in the United States that are all rated PG only. We can figure out a single drop down and filtering, but we can’t figure out how to tie them all together. We need help!

@troy Thanks for reaching out. It would be best to post link to the project and we could debug from there. Also please complete the information below.

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]
Link to the project or level: [replace with link to the curriculum or get the “Share” link to a project]
What I expect to happen: [replace with a detailed description of the behavior you’re trying to create]
What actually happens: [replace with a detailed description of what actually happens when the code runs including any errors or unexpected behavior]
What I’ve tried: [replace with a detailed description of what you’ve already tried to do to solve the problem]

and is your friend. If you can filter each then you can and the conditions together to get exactly what you want.

Link to the project or level: Code.org - App Lab

What I expect to happen: if they chose PG, Movie and United States, they would like to see a list of movies, showing in the United States that are all rated PG only.

What actually happens: What actually happens is that the program is filtering the first two columns, but is not filtering the “Rating”.

What I’ve tried: They’ve tried reordering the sequence of events, but to no avail.

Hmm, I’m not sure I understand the problem.

I added a loop at the end of your generate method to print out the rating and movie title of everything in Ratef after the filter has occurred. When I input PG, USA, Movies, I receive the following table:

"PG The Lake House"
"PG Woody Woodpecker"
"PG Kevin James: Never Don't Give Up"
"PG Race to Witch Mountain"
"PG It Takes Two"
"PG Surf's Up"
"PG A Wrinkle in Time"
"PG The Natural"
"PG The Little Mermaid"
"PG Dr. Seuss' The Cat in the Hat"
"PG The Incredibles 2"
"PG Incredibles 2 (Spanish Version)"
"PG Tremors 3: Back to Perfection"
"PG The World We Make"
"PG The Flintstones"
"PG The Flintstones in Viva Rock Vegas"
"PG Good Burger"
"PG Bolt"
"PG Dolphin Tale 2"
"PG Snow Day"
"PG Christian Mingle"
"PG Earth to Echo"
"PG Jiro Dreams of Sushi"
"PG Turbo"
"PG What a Girl Wants"
"PG New York Minute"
"PG Dragonheart: A New Beginning"
"PG Before the Flood"
"PG The Longshots"
"PG Dad"
"PG Hotel Transylvania 3: Summer Vacation"
"PG Monster House"
"PG God Bless the Broken Road"
"PG Froning: The Fittest Man in History"
"PG G-Force"
"PG The First Wives Club"
"PG Hope Springs Eternal"
"PG Cleopatra Jones"
"PG Inequality for All"
"PG Benji: Off the Leash"
"PG Christmas with the Kranks"
"PG A Boy Called Po"
"PG Rocky"
"PG Judy Moody and the Not Bummer Summer"
"PG National Treasure"
"PG Be Somebody"
"PG The Nutcracker and the Four Realms"
"PG Forks Over Knives"
"PG Christopher Robin"
"PG Water & Power: A California Heist"
"PG The Spiderwick Chronicles"
"PG Alice Doesn't Live Here Anymore"
"PG Holly Star"
"PG Logan's Run"
"PG God's Not Dead: A Light in Darkness"
"PG A Cinderella Story: Christmas Wish"
"PG Hoodwinked Too! Hood vs. Evil"
"PG One Direction: This Is Us"
"PG A.X.L."
"PG Unaccompanied Minors"
"PG Zoom"
"PG Spider-Man: Into the Spider-Verse"
"PG Ralph Breaks the Internet: Wreck-It Ralph 2"
"PG Knock Down The House"
"PG Yours, Mine and Ours"
"PG Grease"
"PG R.L. Stine's Mostly Ghostly"
"PG Little Monsters"
"PG Stuart Little 2"
"PG The Last Whistle"
"PG Popeye"
"PG Spy Kids: All the Time in the World"
"PG Spy Kids 2: The Island of Lost Dreams"
"PG Spy Kids"
"PG Spy Kids 3: Game Over"
"PG The Adventures of Sharkboy and Lavagirl"
"PG Puppy Star Christmas"
"PG Open Season"
"PG Sparkle"
"PG No Reservations"
"PG Aliens Ate My Homework"
"PG Daddy Day Care"
"PG Paul Blart: Mall Cop"
"PG I'm in Love with a Church Girl"
"PG Indiana Jones and the Raiders of the Lost Ark"
"PG Indiana Jones and the Temple of Doom"
"PG Rocky II"
"PG Rocky III"
"PG Rocky IV"
"PG The Lamb"
"PG Evan Almighty"

When I spot check these movies, they look like they are all in fact PG. Are you sure the rating filter is not working? Based on my understanding of your design, the generate function is working as it should.

I do see some potential trouble in the updateScreen() function. I would have students review the idea of variables and scope, and also think about what it is that is actually being stored in the ratef array and how they can use it to access the name of the film.

Good luck,
Madeline