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 / PowerApps LookUp funct...
Power Apps
Answered

PowerApps LookUp function (to sharepoint list records) not working

(1) ShareShare
ReportReport
Posted on by 51

Hello,

I'm struggling to make a PowerApps LookUp function work.

So I have this two sharepoint lists, the first one is a complex form for my company where users must fill some information.
The second one is a list used as a data source, just like a database, where all the information needed for the form is.

So at certain point of my powerapps based form, there is a field where you have to fill a code. I wish that when the user fills the code, all the other information is automatically filled within the data from the second list data.

I've tried:
LookUp('MySecondlist', Code=DataCardValue46, Name)

LookUp('MySecondlist', DataCardValue46.Text = ThisItem.'Code').Name

LookUp(MySecondlist, Code=DataCardValue46.Text).Name

 


But none of it works.

So CODE is a column in the second list. DataCardValue46 is the input for this code in my PowerApps app. Name is also a column in my second list and should be the result.

Please, I've looked everywhere and tried everything, but I can't make this work.

Does anyone have any solution?

Here's a pic of one of my tries:

Captura de tela 2023-02-06 135844 (1).png

(It's in brazilian portuguese, but I think it's understandable)


Thanks in advance!

Categories:
  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @AllanZalla,

     

    Even though the code is not yet working, this looks the closest to what I would expect:

    LookUp(MySecondlist, Code=DataCardValue46.Text).Name

     

    Using the formula bar, can you see the value of DataCardValue46.Text to ensure it is the value you expect?

    Also, if you check the contents of MySecondlist, are they as you expect?

     

    One way to check this list is to save it to a collection then view the collection variable using the formula bar. For example:

    ClearCollect(colMySecondlist, MySecondlist);

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • AllanZalla Profile Picture
    51 on at

    Hey @KeithAtherton , thanks a lot for replying.

    I can't get any values, to be honest.
    So, the DataCardValue46.Text is the input for the user fill with the code. I'm expecting that my "name" input (DataCardValue47) will autofill with this formula, once the user sets manually the code. So I'm applying the formula on DataCardValue47.

    Where should I apply this formula?

    Spoiler (Highlight to read)
    ClearCollect(colMySecondlist, MySecondlist);
    ClearCollect(colMySecondlist, MySecondlist);




  • mmollet Profile Picture
    3,187 on at

    Have you tried to save the item you are looking up into a variable then accessing that to populated the form (local is better probably if only used on one screen)?

     

    You could do something like ClearCollect(item: LookUp('MySecondlist', Code=DataCardValue46.Text))

    This will save that entire list item as an object with the same fields as your column names. This will allow you to use fields of that object using the 'dot' operator like item.Title or item.CreatedOn etc. You can then use these to prepopulate your fields.

  • AllanZalla Profile Picture
    51 on at

    Hey, this looks like a really good solution. But I don't know how to save this into a variable. 
    I'll try the formula you just sent right away.

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Try that code on the app OnStart property so it populates the collection variable, then we can see what values it contains.

     

    Btw the check on the DataCardValue46.Text value was to confirm that it contains the text input entered.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • mmollet Profile Picture
    3,187 on at

    So you can either use something like this:

    Set(item, LookUp('MySecondlist', Code=DataCardValue46.Text));                          <-- Global Variable 

    UpdateContext({item: LookUp('MySecondlist', Code=DataCardValue46.Text)});     <-- Local Variable

    ClearCollect(item, LookUp('MySecondlist', Code=DataCardValue46.Text));            <-- Collection of size 1

     

    For the collection of size 1 you would access that by saying First(item).Name for example. This is saying take the first object in the table called 'item' and return its name value.

  • AllanZalla Profile Picture
    51 on at

    I tried exactly as you guys pointed, put the formula on the OnStart (APP) and it returns me an error. I really don't know what is going on.

  • AllanZalla Profile Picture
    51 on at

    Ok, I'm trying this!

  • AllanZalla Profile Picture
    51 on at

    I'm supposed to set this formulas on the APP OnStart, right?

  • AllanZalla Profile Picture
    51 on at

    I'm receiving a "ParenClose" error. The parentheses seems to be in the right place to me.

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 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard