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 / SharePoint LookUp Retu...
Power Apps
Unanswered

SharePoint LookUp Returns Wrong Data

(0) ShareShare
ReportReport
Posted on by 53,968 Moderator

Hello

 

I am posting this as an FYI as I can 100% repro it so I opened a ticket. 

Scenario:

  • I have an SP List with 2 rows only.
  • The list has 3 columns.
  • Column A Text: Value is a GUID
  • Column B Text: Value is a GUID
  • Column C Text: Value is a string

I set a variable as such in a App OnStart or a Button doesn’t matter

Set(ColumnAGUID, “Row2Value”)

 

I have a component that as an Event, that returns the GUID Value for Row2 ColumnB 

 

I set another variable in the Event Property on the App side

 

Set(ColumnBGUID, Text(ReturnedRow2Value);

 

In the same Event or in a button, I do the following 

 

Notify(LookUp(‘Sp list’, ColumnA = Row2Value And ColumnB = ReturnRow2Value).ColumnC)

 

and each time it returns Row 1 value instead of Row 2

 

I have the Variables written into separate labels. 

the values are correct. If I copy the values and hardcore the LookUp it gives the right value in the Notify. 

Even more. If in the Event or Button, if I copy the Notify and in place of the variables, I use the Label1.Text and Label2.Text in the copied LookUp, which simply holds the value of the Variables, it now works and shows the right ColumnC value. 

So, variable 1 = GUIDA and Label1.Text = GUIDA also. 

Variable 2 = GUIDB and Label2.Text = GUIDB also 

 

but using the Variables directly in the lookup gives the wrong value, but replacing them with their Label.Text counterpart works… 

 

I can even use the same lookup in a button, post Event, and if I use the variables it’s wrong. Then use the labels and it works 

 

Craziest thing I’ve seen in a long while. 

 

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    Not sure what you are doing wrong exactly but I have set up a couple tests to try this and am getting expected results. Maybe on a separate page for testing try setting the following up.

    First I have a button to generate a bunch of random items in a test list for me,

    Patch(VenueList, {Title: "random"&Left(Last(Split(Rand(),".")).Value, 5), testGuid:GUID(), testGuid2: GUID()})


    this was so i could quickly generate 30 or so records and make sure it was working with any number of items in the list

     

    I then made a gallery with

    VenueList

    as its items property (my test sp list)

     

    I made 3 labels inside displaying title, testGuid & testGuid2 just so i could see everything at once. I also placed an icon inside with this OnSelect

    Concurrent(
     Set(selectedItemgui1, ThisItem.testGuid),
     Set(selectedItemgui2, ThisItem.testGuid2));
    
    Notify("The Selected Item is "&LookUp(VenueList, testGuid=selectedItemgui1 && testGuid2 = selectedItemgui2).Title)
    

     

    Pressing it notified me of correct select items title via lookup.

    Outside this gallery I placed another button and gave it the OnSelect of

    Concurrent(
     Set(selectedItemgui1, Last(FirstN(VenueList, 2)).testGuid),
     Set(selectedItemgui2, Last(FirstN(VenueList, 2)).testGuid2));
    
    Notify("The Selected Item is "&LookUp(VenueList, testGuid=selectedItemgui1 && testGuid2 = selectedItemgui2).Title)

     

    (This will always return the second record in the list) It also provided expected results.

    Lastly I placed another button and hard set it with

    Concurrent(
     Set(selectedItemgui1, "dc327b3d-b9ca-4d07-9aed-99630de00095"),
     Set(selectedItemgui2, "0a012315-526a-46ff-a751-c929588d6747"));
    
    Notify("The Selected Item is "&LookUp(VenueList, testGuid=selectedItemgui1 && testGuid2 = selectedItemgui2).Title)

     

    and this also returned the expected record number

  • Michael E. Gernaey Profile Picture
    53,968 Moderator on at

    Oh I agree. It’s just a scenario I ran into. 

     

    After cutting the component out. Pasting it back.  No code changes. At all. It started working. 

    In the past I have seen and helped many ISVs with weird component issues but I’ve never had this one before. 

    seems good now. 

    Cheers

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard