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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set global variable ba...
Power Apps
Answered

Set global variable based on an item in a list with conditon

(0) ShareShare
ReportReport
Posted on by 142

I have a list with two columns as the following specification 

 

requesters : email (text)  ,

                   account_no(text) - may have multiple values separated by a comma,

 

for example :

email                          account_no

joe@abc.com            121323,12022

John@abc.com          123231

Jane@abc.com           10222,102231

In the onStart I am using the following formula to extract the user_account_no.

If (User().Email in Requesters.email, Set(user_account_no, Requesters.account_no));  doesn't work, I know I may have to use lookup or  filter to find the matching item.                                                                                                                                                            I add a lookup function like this.                                                                                                                                                                If (User().Email in Requesters.Title,
Set(user_account_no, LookUp(Requesters, Title=User().Email, account_no) )
);                                                                                                                                                                                                                  still doesn't work.                                                                            

Categories:
I have the same question (0)
  • zmorek Profile Picture
    3,272 on at

    Try giving your If statement a second argument:

    If(
        User().Email in Requesters.Title,
            Set(user_account_no, LookUp(Requesters, Title = User().Email, account_no),
            Set(user_account_no, "Doesn'tExist")
    )

  • skong Profile Picture
    142 on at

    Hi Zmorek,

    I just try it doesn't work.

     

    Thanks

     

    SK

  • zmorek Profile Picture
    3,272 on at

    What error message does it give? Can you add a screen shot?

  • skong Profile Picture
    142 on at

    When I run the onStart it show there are warning messages. The warning message were delegation issues. 

  • Verified answer
    zmorek Profile Picture
    3,272 on at

    Delegation issues are from the LookUp portion of your formula, the  = User().Email isn't delegable.

    Try something like:


    Set(varUserEmail, User().Email);
    If(
        varUserEmail in Requesters.Title,
            Set(varUserAcctNumber, LookUp(Requesters, Title = varUser, account_no)
    )

  • skong Profile Picture
    142 on at

    It works. Thanks a lot. So the delegation warning matter.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard