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 var using lookup t...
Power Apps
Answered

Set var using lookup to a collection

(0) ShareShare
ReportReport
Posted on by 188

Hi there,

 

I have some OnStart code to try set some variables.

 

varUserEmail sets OK. But I cannot set varUserTraderID, it just remains empty.

 

I've tried a few different ways:

 

Set(varUserTraderID,
LookUp(
colUserDetails,AsTraderEmail=varUserEmail).EmailTraderID)

 

&

 

Main OnStart code

Set(varUserEmail, User().Email); 

ClearCollect(colUserDetails,

 {AsTraderEmail:"info@xxx.ie",EmailTraderID:"258"},
 {AsTraderEmail:"aquaxxx@gmail.com",EmailTraderID:"202"},
 {AsTraderEmail:"dxxx@xxx.ie",EmailTraderID:"218"}
 );


Set(varUserTraderID,
LookUp(
 colUserDetails,"AsTraderEmail"="User().Email","EmailTraderID"))

;
InstallHub

 

Categories:
I have the same question (0)
  • drossi90 Profile Picture
    188 on at

    hey any ideas?

  • v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @drossi90 

     

    Please remove the double quotes around the parameters in the LookUp function.

    Set(varUserEmail, User().Email); 
    
    ClearCollect(colUserDetails,
    
     {AsTraderEmail:"info@xxx.ie",EmailTraderID:"258"},
     {AsTraderEmail:"aquaxxx@gmail.com",EmailTraderID:"202"},
     {AsTraderEmail:"dxxx@xxx.ie",EmailTraderID:"218"}
     );
    
    
    Set(varUserTraderID,
    LookUp(
     colUserDetails,AsTraderEmail=User().Email,EmailTraderID))
    

     

    Best Regards,

    Levi

  • drossi90 Profile Picture
    188 on at

    Hey @v-liwei-msft 

    I've previously tried this but this doesn't work. 

    My assumption is that the issue is to do with the User().Email function as if I replace this with just a text string "dxxx@xxx.ie", the varUserTraderID is populated correctly with 218.

    There must be something where the User().Email doesn't match a string of the same email.

  • v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @drossi90 

     

    For testing, you can add a Lable to see if User().Email is equal to the email in the collection.

    vliweimsft_0-1673512388051.png

    OR

    vliweimsft_1-1673512598585.png

     

    Best Regards,

    Levi

     

     

  • drossi90 Profile Picture
    188 on at

    Thanks for your efforts here @v-liwei-msft , I really appreciate it

    I've tried that also but with no luck, the email var updates but not the TraderID var.

    drossi90_0-1673513106513.png

    drossi90_1-1673513258711.pngdrossi90_2-1673513301731.png


    And yes, User().email is equal to the email in the collection as you can see above.

     

  • drossi90 Profile Picture
    188 on at

    Sorry typo on the first screengrab there. I was playing around with column names and can confirm I have:

    Set(varUserTraderID, Text(LookUp( colUserDetails,User().Email=AsTraderEmail,EmailTraderID)))

  • v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @drossi90 

     

    You can try the second method I gave you to see if Lable returns a value.

     

    Best Regards,

    Levi

  • drossi90 Profile Picture
    188 on at

    Hey @v-liwei-msft 

    indeed it does

     

    drossi90_0-1673513782387.png

     

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

    Hi @drossi90 

     

    According to the screenshot you provided, User().Email returns Drossi.
    In your collection, I found that the field you want to query is drossi.
    I think the reason LookUp doesn't return a value is because of case differences.

     

    Best Regards,

    Levi

  • Verified answer
    drossi90 Profile Picture
    188 on at

    No way! it's case sensitive? I didn't realise that! 

    Apologies. Thanks for all your help in troubleshooting. I spent far too much time over that!

     

    It works! Thanks

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard