web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / I can't get a simple l...
Power Apps
Unanswered

I can't get a simple lookup function to work

(1) ShareShare
ReportReport
Posted on by 12

I have a connected table Named Current_Session. I have a Text Label on my canvas app where i want the text to = Lookup(Current_Session, SessionRef = 1).SessionName. This returns Blank. What am I possibly doing wrong?

 

Table Name = Current_Session

SessionRef

SessionName

1Session: 45698.36985; REBAG A
Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    It's because the LookUp Returns a Table even if it just contains 1 row. For you to retrieve that row and use its property Session name, Use the First command. Below should do it.

     

    First(Lookup(Current_Session, SessionRef = 1)).SessionName

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @cha_cha 

    You are wrong.  LookUp() returns the first record in a table that matches the criteria.  You are thinking of Filter() which returns a table.  Your formula should work or you can try Lookup(Current_Session, SessionRef = 1, SessionName)

  • RCWh3rry Profile Picture
    12 on at

    so my first issue seems to be SessionRef = 1, it gives me an error saying "Incompatible types for comparison. These types can't be compared: Text, Number.", However SessionRef is the column name in the data table and 1 is the first value in that column. do i need reference the column name within the formula differently?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RCWh3rry 

    The problem is that your table considers SessiionRef to be text.  Try Lookup(Current_Session, Value(SessionRef) = 1).SessionName

    Value() changes SessionRef to a number so it can be compared.

  • cha_cha Profile Picture
    4,932 Moderator on at

    @Drrickryp Thanks for pointing that out. I'm very dependent on PowerApps suggestions and auto complete.

  • RCWh3rry Profile Picture
    12 on at

    That does fix the error in the formula, however it still returns the formula = Blank. I'm lost as to why it will not return the value in the SessionName column? 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RCWh3rry 

    To troubleshoot this, put a datatable on your screen and set it's DataSource to Current_Session and see what values you get in the SessionName column. Please specify the type of datasource you are using and the type of column SessionName is.  

  • RCWh3rry Profile Picture
    12 on at

    so the data source is an excel spreadsheet added through OneDrive. I added the data table to the screen, added the filed SessionRef (which says its a text field), but it says there is no data to display.

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RCWh3rry 

    Excel is a terrible data source and I suspect that it has become corrupted in some way. Once a table has been imported, any changes to the schema in Excel will corrupt the table. 

    Delete the current table from Powerapps.   Go back to Excel and copy the data to a new table without the last column (the one added PowerApps).  Set the column types to either Text or Number, make sure there is a value in the first row below every column header even if you have to sort the table and re-import the data back into PowerApps.  Consider moving the data to SharePoint and watch Shane Young's video https://www.reddit.com/r/PowerApps/comments/l5n0q1/video_learn_why_excel_is_a_terrible_data_source/   

  • RCWh3rry Profile Picture
    12 on at

    I removed the table in the excel sheet and re-added it. I also removed the data source from the power app and re-added it through excel online instead of through Onedrive. this fixed the issue and it works now. Thank you!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard