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 / 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard