← Code

Data apps

Apps that keep data, and find things in it.

Start1. Two lists that must agree
For teachers Usually Years 8–9 · 7 lessons (and 2 optional)

Build 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.

  • Usually Years 8–9
  • Lessons 7 (and 2 optional)
  • Do first App Builder apps
Teacher guide

Standards, in general: main focus: Trace algorithms for errors (8P06). What this means

Lists that must agree

Two lists that describe the same songs, linked only by place.

1Two lists that must agreeNot started

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.

  1. Try the finished app
  2. Build 1: add to both lists
  3. Build 2: remove from both lists
  4. Check: when the lists disagree › What happens to Cove?
  5. Check: when the lists disagree › Find Nib's mistake
  6. Make it yours: a third list › Add a Lengths list
  7. Make it yours: a third list › What about sorting?
Start lesson

Tables and records

One row per song, a field for each detail; read fields, total a column, find the longest.

2One table insteadNot started

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.

  1. Try the finished app
  2. Build 1: make the table
  3. Build 2: show it on the screen
  4. Build 3: add a row
  5. Build 4: click a row to remove it
  6. Check: rows and fields › Which song is row 2?
  7. Check: rows and fields › Can they get out of step?
  8. Make it yours: a genre field › Add a genre
  9. Make it yours: a genre field › Test it with someone
Start lesson
3Records and fieldsNot started

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.

  1. Try the finished app
  2. Build 1: now playing
  3. Build 2: a running total
  4. Build 3: the longest song
  5. Check: trace the loop › Trace the total
  6. Check: trace the loop › Find Nib's mistake
  7. Make it yours: average and shortest › The average
  8. Make it yours: average and shortest › The shortest song
Start lesson

Saving between visits

Remember the table in the browser; tell a first visit from a return visit; keep a picture in every row.

4Saving between visitsNot started

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.

  1. Try the finished app
  2. Build 1: remember the songs
  3. Build 2: first visit or return visit?
  4. Check: where is it kept? › Another computer
  5. Check: where is it kept? › What does Save keep?
  6. Make it yours: remember the last song › The last song added
  7. Make it yours: remember the last song › On a shared computer
Start lesson
5A journal with drawingsNot started

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.

  1. Try the finished app
  2. Build 1: a table with a picture field
  3. Build 2: add a row for each entry
  4. Build 3: show the table, see one big
  5. Build 4: remember it, then tidy up
  6. Check: Nib and handing it in › Nib's slip
  7. Check: Nib and handing it in › Sharing
  8. Hand it in
Start lesson

Search

Sort whole rows; copy the rows that match into a second table.

6Search, filter and sortNot started

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.

  1. Try the finished app
  2. Build 1: sort
  3. Build 2: search
  4. Build 3: filter the short songs
  5. Check: keep the songs safe › Find Nib's mistake
  6. Check: keep the songs safe › Text or number?
  7. Make it yours: search artists, show all › Search artists too
  8. Make it yours: search artists, show all › Show all
Start lesson

Final challenge: your own data app

Plan, build and test a data app for a real user.

7Challenge: your own data appNot started

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.

  1. Plan: which tool for which job?
  2. Milestone 1: plan the table on paper
  3. Milestone 2: add and show
  4. Milestone 3: remember and find
  5. Milestone 4: test with a real user
  6. Milestone 5: improve one thing
Start lesson

Linked tables

Two flat tables joined by a shared value, as in a database.

8Two tables that link OptionalNot started

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.

  1. Try the finished app
  2. Build 1: show a playlist's songs
  3. Build 2: a heading with a count
  4. Check: what links them?
  5. Look at it nested
  6. Make it yours: add to a playlist › Add a song
  7. Make it yours: add to a playlist › Check it stays put
Start lesson
9Build around a simulation OptionalNot started

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.

  1. Try the finished app
  2. Build 1: show the period
  3. Build 2: change gravity
  4. Build 3: record a reading
  5. Check: what gets through?
  6. Use your lab
  7. Make it yours: start again › Clear the readings
  8. Make it yours: start again › One more idea
Start lesson

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)