web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to expand a variab...
Power Apps
Answered

How to expand a variable to a screen name for Navigate?

(0) ShareShare
ReportReport
Posted on by 5

I can't figure out how to pass a text to the screen name argument of the Navigate function.

I can generate the text of the next screen name, and use it in a label, but I can't seem get navigate to accept anything other than manually entered text.

 

I've been unsuccessful with the following approaches (and variants that I've lost track off)...

 

Navigate(Screen & (scrNum+1),ScreenTransition.Fade))

Navigate(Screen & Text(scrNum+1),ScreenTransition.Fade)

Navigate(Text("Screen" & (scrNum+1)),ScreenTransition.Fade)

Navigate(Concatenate("Screen",Text(scrNum+1)), ScreenTransition.Fade)

 

I also tried simplifying the expansion by removing the arithmetic and iterating through the above

 

UpdateContext({nextScr:(scrNum+1)};

Navigate(Screen & nextScr),ScreenTransition.Fade)

 

Can anyone tell me what I'm doing wrong? 

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @CMetcalfe 

    You cannot refer to a screen name indirectly in PowerApps as you are attempting to do.

    It's not ideal but you can use SWITCH like this if your app is being developed over several screens.

     

    Set(scrNum, scrNum + 1);
    Switch(
     scrNum,
     1, Navigate(Screen1, Fade),
     2, Navigate(Screen2, Fade),
     3, Navigate(Screen3, Fade),
     4, Navigate(Screen4, Fade),
     5, Navigate(Screen5, Fade)
    )

     

    The other approach would be to put everything on a single screen and make the controls visible when the appropriate page number matches the variable scrNum.  It would involve putting code like this in the Visible property of each control.

    scrNum=1 //if you want the control to show when on Page1

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • CMetcalfe Profile Picture
    5 on at

    Hi @mdevaney - thank you for taking the time to respond, even if it wasn't the answer I was expecting!

     

     

    Sigh:  So the Navigate function only accepts strings that originated from the keyboard?  How does it even tell? /s  😉

     

    I'll just have to go through my project and manually edit all of the 'advance' icons.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @CMetcalfe 

    Q: "Sigh:  So the Navigate function only accepts strings that originated from the keyboard?  How does it even tell?"

     

    A:  References to screen names must always be static (as opposed to variable).  Right now that's just the way things are...

     

    Have you ever encountered the INDIRECT function is Microsoft Excel?  To enact your solution that's essentially what would be needed to do it.  INDIRECT takes a string as an argument and evaluates to a cell reference.  In PowerApps we would need INDIRECT to evaluate to a control reference.

     

    If you have a strong desire to see this functionality included in PowerApps you can always go create an Idea and encourage others to vote on it.

    Link to MS Ideas

    https://powerusers.microsoft.com/t5/Power-Apps-Community/ct-p/PowerApps1

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @CMetcalfe ,

     

    The control cannot be called by its string name!

    the Screen1 you entered in the formula bar is a control, but the "Screen1" is a string, they are different type.

    Snipaste_2019-12-16_17-06-12.pngSnipaste_2019-12-16_17-07-54.png

    Currently, the function to invoke controls as strings is not supported in PowerApps. If you want this feature, please submit an idea to PowerApps Idea forum.

    Best regards,

    Sik

  • CMetcalfe Profile Picture
    5 on at

    @v-siky-msft:  Thank you for your response.

     

    The distinction between a control name and it's 'string name' isn't very intuitive, but your screenshots showing that they are different data types was helpful.

     

    Cheers!

  • rschneider Profile Picture
    77 on at
  • CU15091556-0 Profile Picture
    49 on at

    Here's where you can upvote this.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard