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 / Variable is not workin...
Power Apps
Unanswered

Variable is not working as expected

(0) ShareShare
ReportReport
Posted on by
With({userrecord1:LookUp(owner,Title=TextInput1.Text And Password=TextInput1_1.Text)},Switch(userrecord1.Role.Value,"Admin",Navigate(Wattala),Set(varuser,userrecord1.Title)))
 
Please ignore the commas and parenth.. My set variable is not working.It gets the var user( Variable name but not the value from sharepoint). Kindly help to recorrect.
Screenshot 2023-12-28 165525.png
Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @powertwo123,

    You write this With() formula for the OnSelect property of Button2_1?

    Could you please tell me that if you userrecord1.Role.Value returns Admin or not?

     

    Based on your formula, wether the varuser is blank or not depends on if userrecord1.Role.Value returns Admin.

    If it does return Admin, then, your varuser does return blank because the Switch() statement only process the Navigate() function.

     

     

  • WarrenBelz Profile Picture
    154,393 Most Valuable Professional on at

    Hi @powertwo123 ,

    It is because you have it inside a Switch statement and it the first part works, it will never run. I am not totally clear on you model, but I think you need something like this.

    If(
     LookUp(
     owner,
     Title = TextInput1.Text And Password=TextInput1_1.Text
     ).Role.Value = "Admin",
     Navigate(Wattala)
    );
    Set(
     varuser,
     TextInput1.Text
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard