Create list on one screen - Display list viewer on another

Am working on the flowchart for a test I want to run.

essentially I want to save strings to a list (lk the to do list tutorial) and on another screen I want to display them. and I want the changes to be persistent so once the app is closed and opened the items added to the list are still present

so my question is…what would be the most efficient way of doing so. I thought a cloud variable/firestore, but then it seems like a local stored solution would be faster. so I’ve been reading about all the storage options and I still can decide or have dropped a single block.

suggestions?

thx

save your list to a stored variable.

you could save it as a list of strings

so

initialize a stored var, name it ‘listOfPhrases’

on screen 1 open
if stored listOfPhrases = null
set stored storedd listOfPhrases as empty list

when button save clicked
in stored listOfPhrases add last as text input

on screen 2 open
set list viewer items as stored listOfPhrases

1 Like

tested it real quick and works… thansk!!!

i’ve decided i want to make an address book/directory, just to teach myself other aspects of the platform. I realized I haven’t used lists or dbs at all yet.

so on one screen the information will be entered
Name:
Phone:
Address:
Email:

Save Button

Screen 2 - Shows a list of the saved names and when each item is pressed the corresponding info will be shown on another screen.

the firebase thunk x tutorial on firebase (YouTube Link) is the same concept…

1 Like

Perfect! Now, time to make it appear on the same screen for faster contact retrieval!

Less screens = less code = less potential issues

I only suggest this because a full screen list isn’t so attractive. With such a small amount of info, you could easily create a display dashboard below the list to display all info when a name is clicked from the list.

yeah that is true…very good point!

ahh silly question…can variable to be set to text? when I run this block it shows as an empty item on the list
txtToVar

that does work,

the code you show would only save the item to a list though. it would not display it anywhhere

correct this is how I display the list, is on another screen. if is send the txt block to the list it displays no problem. But if I send it as shown the list item is blank.
am just curious as to why.

txt_list

I imagine that you have not set storedListOfPhrases as a list and instead are simply adding to an initialized variable. The variable is not a list by default, you must make it this way.

there are two ways to do this.

Set it to an empty list, or set it to be an already existing list.

otherwise its like you’re throwing a ball to someone who doesn’t know they are supposed to catch it. it’s not that they don’t get the ball, it’s that their hand is not ready to catch. You must not only create the variable, you must also set it in the blocks to be a list before adding items to the list.