← Teacher guide

Saving between visits

Students make the playlist remember its songs between visits with App Builder's Remember toggle (💾) on the Songs table, test return visits with Restart and first visits with Forget saved data, and greet the user differently on each with count(Songs) in an On start of screen event with Else. The Check separates what the browser keeps from the project file and from other computers.

Data apps · Saving between visits · about 45 minutes · Open the student lesson

Classroom resources

Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Try 5 min · Build 1–2 20 min · Check 8 min · Make it yours 12 min

Before class

Remember between visits keeps values in the browser's local storage, under this lesson step's own key: on this computer, for this browser user. Nothing is sent anywhere, and nothing goes into the project file (Save keeps the starting rows).

On shared computers, the next person in the same browser sees what was remembered. Keep data made up, and talk about it: it's a real design question for any app.

Running the lesson

  1. Before Build 1 (whole class): which apps remember things between visits? Where do you think they keep it?
  2. Build 2: test both visits before moving on: Restart with songs, then Forget saved data.
  3. Check: the Kai question is worth a minute's discussion: who else could see a saved journal?

In class

On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.

The hard part (on purpose)

Testing: students expect to close the page. Restart (a return visit) and Forget saved data (a first visit) test both without waiting.

When students get stuck

What you will seeA question to askThe fix
Songs are gone after Restart.Is the 💾 on Songs lit?Click it so it's lit, add songs again, then Restart.
The welcome message never changes.Is the condition on a sub-event of On start of screen, with the Else below it?On start of screen has no actions; its sub-event compares count(Songs) = 0, and the Else sits right under that sub-event.
Forget saved data isn't there.Is anything remembered yet?It shows once a variable, list or table has its 💾 lit; switch tabs and come back to Run.

Answers to the checks

  1. Another computer: Kai's playlist remembers Songs. Kai adds five songs at home, then opens the same app on a school computer. What does the table show?
    Only the starting rows
    Remember between visits keeps the songs in the browser the app ran in, on that computer. Another computer has nothing saved, so the app starts from its starting rows.
  2. What does Save keep?: Kai presses Save at the top and hands in the project file. Which songs are in it?
    The starting rows typed in the sidebar
    The project file holds how the app is built, including the rows it starts with. What a user adds while it runs is kept by the browser, separately.

Solutions

One possible solution for each task. Other correct programs are fine.

Make it yours: remember the last song › The last song added

{"version":1,"name":"Saved playlist","device":"web","features":{"level":4},"variables":[{"name":"Songs","table":{"fields":[{"name":"title","type":"text"},{"name":"artist","type":"text"},{"name":"length","type":"number"}]},"value":[{"title":"Blue Sky","artist":"Kai","length":3}],"remember":true},{"name":"LastAdded","value":"","remember":true}],"screens":[{"id":"home","name":"Home","objects":[{"name":"Title","kind":"text","instanceVars":[],"instances":[{"id":"h1","x":24,"y":16,"w":500,"h":40,"text":"My playlist","visible":true,"vars":{}}]},{"name":"TitleLabel","kind":"text","instanceVars":[],"instances":[{"id":"l1","x":24,"y":64,"w":60,"h":36,"text":"Title","visible":true,"vars":{}}]},{"name":"TitleInput","kind":"input","instanceVars":[],"instances":[{"id":"i1","x":84,"y":60,"w":170,"h":42,"text":"","visible":true,"vars":{}}]},{"name":"ArtistLabel","kind":"text","instanceVars":[],"instances":[{"id":"l2","x":268,"y":64,"w":60,"h":36,"text":"Artist","visible":true,"vars":{}}]},{"name":"ArtistInput","kind":"input","instanceVars":[],"instances":[{"id":"i2","x":328,"y":60,"w":150,"h":42,"text":"","visible":true,"vars":{}}]},{"name":"LengthLabel","kind":"text","instanceVars":[],"instances":[{"id":"l3","x":492,"y":64,"w":70,"h":36,"text":"Minutes","visible":true,"vars":{}}]},{"name":"LengthInput","kind":"input","instanceVars":[],"instances":[{"id":"i3","x":566,"y":60,"w":70,"h":42,"text":"","visible":true,"vars":{}}]},{"name":"AddButton","kind":"button","instanceVars":[],"instances":[{"id":"b1","x":650,"y":58,"w":130,"h":46,"text":"Add song","visible":true,"vars":{}}]},{"name":"SongTable","kind":"table","instanceVars":[],"instances":[{"id":"T1","x":24,"y":160,"w":560,"h":280,"text":"","visible":true,"vars":{},"source":"Songs","columns":""}]},{"name":"WelcomeText","kind":"text","instanceVars":[],"instances":[{"id":"t1","x":24,"y":116,"w":560,"h":36,"text":"","visible":true,"vars":{}}]}],"events":[{"id":"e1","else":false,"conds":[{"type":"onClicked","target":"AddButton"}],"actions":[{"type":"tableAdd","table":"Songs","values":{"title":"TitleInput.text","artist":"ArtistInput.text","length":"int(LengthInput.text)"}},{"type":"setVar","var":"LastAdded","value":"TitleInput.text"}],"children":[]},{"id":"e2","else":false,"conds":[{"type":"onStart"}],"actions":[],"children":[{"id":"e2a","else":false,"conds":[{"type":"compareValues","left":"count(Songs)","op":"=","right":"0"}],"actions":[{"type":"setText","target":"WelcomeText","value":"\"Add your first song\""}],"children":[]},{"id":"e2b","else":true,"conds":[],"actions":[{"type":"setText","target":"WelcomeText","value":"\"Welcome back. Songs saved: \" & count(Songs) & \". Last added: \" & LastAdded"}],"children":[]}]}]}]}

Make it yours: remember the last song › On a shared computer

Open task: any program that does what the step asks.

Stretch and support

Stretch: Remember how many times the app has been opened: a remembered variable that goes up by 1 on start of screen.

Support: Demonstrate a return visit and a first visit on the projector before students build.

Exit ticket

Your app remembers a table of scores. A friend opens it on their own laptop. What will they see, and why?

Only the starting rows: remembered data is kept in the browser where it was added, not in the project or online.

What each step is for

Where it leads

Next: Search, filter and sort.