Apps that keep data, and find things in it.
★ Challenge completeBuild apps that keep and use data, in App Builder: a playlist that starts as two lists that must stay in step, becomes a table of records (one row per song, a field for each detail), is remembered between visits, and can be searched, filtered and sorted. Each idea is an algorithm students will meet again in Python and databases: a running total, a best so far, a linear search, a filter. The challenge is a data app of their own for a real user. An optional last lesson links two tables, the way databases do.
Standards, in general: main focus: Trace algorithms for errors (8P06). What this means
Two lists that describe the same songs, linked only by place.
Build a playlist that keeps song titles in one list and artists in another, with each song's details at the same place in both lists. Adding and removing must change both lists together. Removing from just one shows why: every song after it gets the wrong artist.
One row per song, a field for each detail; read fields, total a column, find the longest.
Rebuild the playlist with a table: one row per song, a column for each field (title, artist, length). Each song's details live together in one row, so adding or removing a song can't split them up. A Table object shows the table, and clicking a row removes that song.
Use the songs in a table: show the clicked song as Now playing, add up every song's length with For each row, and find the longest song by keeping the best one so far. Each row is a record, and LoopItem.length or ClickedItem.title reads one field of it.
Remember the table in the browser; tell a first visit from a return visit; keep a picture in every row.
Make the playlist remember its songs when the app is closed and opened again: tick Remember between visits on the Songs table, test a return visit and a first visit, and greet the user differently on each. The songs are kept in this browser only.
Give every journal entry its own drawing: a table Entries with a picture field, a row added for each entry, a Table on the Journal screen with a thumbnail per row, and a click to see one big. Remember it between visits, tidy away the old list, and hand it in as a file with the drawings inside.
Sort whole rows; copy the rows that match into a second table.
Find songs in a bigger playlist: sort the table by title or by length, search the titles for some typed text, and filter the short songs. Searching and filtering both use the same algorithm: go through every row and copy the ones that match into a second table, so the original songs stay as they are.
Plan, build and test a data app for a real user.
Plan, build and test a data app of your own for a real user: a reading log, sport stats, a collection, a practice log. It keeps records in a table that's remembered between visits, and helps the user find what they need with search, a filter, a sort or a total.
Two flat tables joined by a shared value, as in a database.
Keep playlists and songs in two tables joined by a shared value: each song names the playlist it belongs to. Clicking a playlist shows its songs, found with the same For each and condition as a filter. This is how databases keep data: flat tables, linked by a value they share.
An Embed shows a ready-made pendulum simulation, made as one web page. The page sends its period and length; the app sends it gravity. Students build the app around it with events: show the period when the page sends it, change gravity with planet buttons, and record readings in a table to answer a science question. The simulation is a component with inputs and outputs, the way real apps use parts other people made.
Progress is saved in this browser only. Nothing is sent anywhere.
For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)