Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

SharePoint LookUp Returns Wrong Data

(0) ShareShare
ReportReport
Posted on by 41,385 Super User 2025 Season 1

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. 

 

  • Michael E. Gernaey Profile Picture
    41,385 Super User 2025 Season 1 on at
    Re: SharePoint LookUp Returns Wrong Data

    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

  • TheRobRush Profile Picture
    11,121 Super User 2025 Season 1 on at
    Re: SharePoint LookUp Returns Wrong Data

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,017 Most Valuable Professional

Leaderboard