Same blocks in different pages... Could it be done better?

This is the problem right here:

7b5d4ffc152ad4bc86f03b5230310a523479bf91

(Sorry, your screenshot was really small so the quality is poor)

You are manually naming the variable as RowNumVCBLRApp but there is no variable with that name. The variable you initialized is called RowNumVCBLR. I would not use the set app variable block you are using. Instead, use the normal set app variable block at the top of the Variables drawer where you don’t have to type in the name… you just select it from a drop-down menu.

1 Like

Sorry about the size, but actually I have an App variable called RowNumVCBLRApp started, but I don’t really know if I have to “set stored variable RowNumVCBLR to AppvariableRowNumApp” or if it’s the other way around, or if it’s “set AppvariableRowNumApp to StoredvariableRowNum”, and where should I place it. Anyway, it’s going faster than before

Sorry for not noticing that.

Even so, I would use the drop-down menus… that’s just me.

You have it backwards. You need to set app variable to stored variable after the Wait block. What you’re doing is first setting the value of the stored variable (to 1). That saves it to the device. Then, you’re transferring the value to an app variable that will be used throughout the screen. If you ever make a change to the app variable, then you need to save it to the device by doing set stored variable to app variable.

1 Like

As it is a vocabulary list, I suppose to save the changes every time I have loaded the page, after pronouncing Spanish, British and American or after pressing the ‘forward’ or ‘back’ buttons, or is it better somewhere else?


Thanks

That sounds fine. It all depends on how important the saved value is. If it’s lost, how much of a problem is that?

Normally, I just set the stored variable to the app variable any time the value changes. But it’s not required. You could do it when the screen changes or every 30 minutes… it’s up to you!

What does that variable keep track of?

This variable keeps track of which word should appear on the screen, to prevent unnecessary repetitions, and therefore I think it has to be renewed in each word. Then…,
Should I put it on the page up and / or back buttons, or just “when xxx opens”? Do I have to change “change stored variable xxx by 1”, or should it be change App variousble xxx by 1 “in” when xxx 0pens "?

What you have there looks good. The only thing I would do differently is to change the app variable by 1 at the bottom. That way both the app and stored variable values get changed. Right now, you’re only changing the stored variable there.

Thank you very much. A great help.

And about the forward and backward buttons, do I need the last block "set stored variable xxx to app variable xxx?

Only if you are changing the app variable value. I mentioned this before but I left out the word “app” so it may have been confusing.

I assume that when you go forward or backward, you are going to change the value of the app variable (even though I don’t see it in your screenshot). If you change the app variable value, then save it to the stored variable.

Remember that you could use stored variables only and things would work great. They just might be a tiny bit slow. The advantage of using app variables is speed. The app variables act as temporary storage because if the app is quit or the device turns off, they don’t retain the values. So if you want to save values in case of that happening, you put them in stored variables. So a safe rule of thumb is any time you change an app variable value, also set the stored variable to that app variable value.

If you are not changing the app variable value then you don’t need to worry about the stored variable.

1 Like

Thanks so much

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.