Is there a way to get the name of the screen?

I’m wanting to be able to navigate from screen to screen based on the name of the screen.
Another option would be to obtain a list of the screens or count the screens. Just some way where if I change the order of the screens or rename the screens in my project it would update accordingly.

I couldn’t find anything in the forums where it would update based on changes I made to the project.

Thanks Thunkers

1 Like

When you change a screen name the navigate to screen will change to reflect the new name.

The navigate to component can also take a variable instead of the default screen menu

image

This is an example

I did know about those 2 things, but is there a way to update the variable to also reflect the name of the screen if you renamed it?

If you rename a screen in the Design tab, the “navigate to” block’s value updates automatically. You can also, as @muneer pointed out, use variables or even a text block with a screen’s name to navigate to a specific screen.

But it sounds like you’re also concerned about the order of the screens and what happens if you re-order them.

Can you say a little bit more about a specific example of what you’re trying to do?

1 Like

Right, so if I change the name of a screen, I want the variable to update to it.

If you use a variable, it won’t auto-update. But if you just leave the value as is with the built-in screen name block, it will auto-update. You can try it. Drag a new “navigate to” block onto your Blocks tab, then rename the screen it’s set to navigate to. The value will update immediately to the new name.

1 Like

Ok so that can’t be done for now. Thank you guys for the help

I don’t think you’d need this if you changed the order of your screens @overshield - do you have a specific use case where it doesn’t work for you?

1 Like

So sometimes when I’m building I’ll work on a screen and it becomes complex enough that it should be 2 separate screens. And instead of updating a list of screen names each time, it would be nice if there was a block that just said “get screen name” so that regardless of the names of the screen or any of that it would just update.

Then if I wanted the users to be able to revert to the most recent screen prior to the current screen the back button would auto take them to it.

It’s no biggie I can just make a list of screen names as variables and update them as I go. I’ll debug it if I find I’ve renamed a screen and it stops working.

Thanks everyone.