Saving tabs during a session

When you select an item from the drop-down list, you need to create a new tab. It works. But it is not saved when you go to the next screen. how to solve this problem?Tabs

Use a TinyDB to store the selections in a list. Then when the screen initializes check for each item in the list and add new tab for each one

I did it like this, but it doesn’t work. Can you give an example?

blocks (4)

Try this^

If you want to create and save multiple tabs (eg. kitchen and more tabs) you would have to save these in a list and retrieve them like this:

an error appears “Bad list argument for each (The second argument to foreach is not a list)” and “Bad arguments to add items to list”

Clear the tag first as you have used it already and also i made a mistake in the screen initialize block. In the ‘value if tag not there’ put the ‘create empty list’ block.

the error is “Bad arguments to add items to list” remained

Sorry do the same for the get value block in the spinner ‘After selecting’ use ‘create empty list’ for the value if tag not there. Also clear the tag first since its been used

This works for me, anything that is selected, a tab is created for it even when switching the screen.

Everything works. But I probably didn’t explain correctly what I want. I need that when opening a new screen, I selected a drop-down list item and a tab with the item name was created. Then, opening the next screen, I should see the same tab. It should be saved until you exit the app. when you start again, everything starts over again - the tab is missing.

So would it be only one tab?
If so then my first method where you save the selection in tinyDB is suitable. To reset it when you start the app again, then you would need to check somehow whether screen1 is being opened from another screen or when the app is opened. If screen1 is opened from another screen then you create the tabs from the tinyDB else you don’t.
To check whether screen1 is opened from another screen or if it is opened when the app is opened you can use ‘open screen with start value’ and check whether a start value exists in screen1.

In the first method, the tab immediately gets the value of the first element of the list, and I need that when initializing the screen, there are no tabs. The tab should appear after I select any value from the spinner.

I have another option: create a tab with the name Room 1. Then I select any element from the spinner and the name of the tab is assigned the value of the element. Is it possible?

Yes it is possible. Let assume that you have created tab Room1 in position1 then when you select an item from spinner do …


1 Like

Thanks! But the problem of saving the tab name when switching to another screen is not solved

I can not understand what you are trying to achieve . For example screen 1 has any tabs ? For example Room1, Room2, Room3 ? If someone chooses Room1 a spinner appears with choices ? Please provide more info

tab.aia (3.7 KB)

Still unsure what you are trying to do but try this

tab_1.aia (4.2 KB)

Not quite the right thing. The pictures show how it should be.