Error with replacement block


#1

What I want to do is assign in a list 2 places where 1 will have the value of the current screen and the other will check the name of the previous screen, which is pretty handy for processes that include other screens.

Now, I’ve tried using replacement with a error like the image shows and from the previous screen I’m using a simple List with values, when I’m trying to access the next one.

Problem is that replacement doesn’t work. I don’t know if it is a bug, or if it is something else, but until I learn I will leave a post here in case someone, anyone, helps me fix it or point out my error.

Capture Capture2


#2

I’m not sure what the goal is here… It looks like you are trying to pass a list between screens and trying to keep track of which screen you’re on or coming from?

Have you tried doing it with the close screen with value and .OtherScreenClosed blocks?

Makes passing data and keeping track of which screen was just closed very easy.

image


#3

To add to the above, the screen value and screen name are different. This block does not make ay sense.


#4

I’m sorry for the late reply. You see I want to open up specific screens and parse values between those screens, for example I have a starting screen, which is Screen1, with a username and a password to a second screen named Screen2.

In order to keep track which screen I close and which one I open I tried to create a list which changes based on the previous screen that parsed it’s name as a value, for our example passing from Screen1 to Screen2 our list will have the value “Screen1” in the fourth position of our list which means that when I open Screen2 I will have a list that was parsed from the previous screen which contains in the 4th place the value “Screen1”.

TL;DR I need a way to change a list in a way that I’m closing screens as well as I parse specific values, so that I don’t waste a lot of memory. That’s why I tried to use replace, which unfortunately doesn’t work.


#5

Use TinyDB as the place to show what screen is on or not.

You can pass all the values through screens with TinyDB


#6

Dealing with screens can be tricky…

Screens are opened on top of whatever screen called the new screen. These screen openings will stack up and can get out of hand…

What I mean is that if you open your app (Screen1), then open Screen2 and then open Screen3, these three screens are now layered on top of each other. If you close Screen3, you will be taken back to Screen2 because you never closed it. Closing Screen2 would then take you back to Screen1.

To keep your screens under control, you need to properly close them.
(see Ken’s reply post below)

  • When you open another screen, use the open another screen with start value block. This will allow you to easily pass pass data to the new screen.
    (see when btnScreen2.Click and when btnScreen3.Click in “Screen 1 Blocks” below)

  • To access this data in the new screen, use the get start value block.
    (see when Screen2.Initialize in “Screen 2 Blocks” and when Screen3.Initialize in “Screen 3 Blocks” below)

  • When you close a screen, use the close screen with value block. This will allow you to easily pass data back to Screen1.
    (see when btnScreen1.Click in both “Screen 2 Blocks” and “Screen 3 Blocks” below)

  • To access this data in Screen1, use the when Screen1.OtherScreenClosed block. It has two variables attached. otherScreenName and result.
    (see when Screen1.OtherScreenClosed in “Screen 1 Blocks”)

Anyway, I’ve attached a simple example .aia to show how to pass data between screens. (You should notice that I close the screens as I’m done with them, as I’ve mentioned above). There are three screens and each one has two textboxes for the “data” we want to pass. Type in some data and click a button. The resulting screen will show your data. In this new screen, feel free to change the original data in the textboxes and then click the button and your new data (or old data if you didn’t change it) will be passed back to Screen1.

Screen 1 Blocks

Screen 2 Blocks
Screen2

Screen 3 Blocks
Screen3

Screen_Passing.aia (6.6 KB)

Yes, you could just use a TinyDB to pass data between screens as well, however, if the data being passed doesn’t need to be preserved after the app is closed, it’s kind of a waste to use TinyDB when the built-in controls can already do this and without having to create the TinyDB file on the users device.

EDIT: Now that I’ve posted this, I’ve just noticed that adding the screen names to the data being passed is kind of redundant and not needed. Meh, it works and it’s been a long day for me. LOL


#7

@DocDrydenn,
If you were talking about this being the best method to his problem and not a general statement, disregard the following.

I agree with pretty much everything you said except this:

Screen1 is the Launch Activity.
Which just means it’s the first thing(Activity) to open when the app is launched.
That is the only major difference between Screen1 and any other screen.

This is the method I use when opening other screens:

Example:
ScreenTest.aia (3.9 KB)


#8

… learning new stuff every day.

I don’t want to admit how much time I spent trying to do what your 5 blocks above do. Ugh. I will correct my post. Thanks.


#9

I’ve been using AB for around 15 months & make extensions and I learn something new everyday as well!