cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

LookUp last entry submitted by User

Hello, 

 

Need a little assistance with a simple expression. I have a SharePoint list as the data source. In my powerapps screen I want the 'Site Lookup' field (which is a Choice dropdown field) to default to what that user chose for that field on the last entry. 

 

This is what I am thinking, but need help so that it only takes the last entry by that user:

 

LookUp('Driver Activity Log',Date=First('Driver Activity Log'),'Site Lookup')

 

Also the 'Site Lookup' reference (in red) isn't working? perhaps because it is a choice field?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: LookUp last entry submitted by User

Hi @TorreyFalconer ,

Firstly, Date is a fieldname, First('Driver Activity Log') is a record, you can not compare a field with a record.

Try this:

LookUp('Driver Activity Log',Date=First('Driver Activity Log').Date,'Site Lookup')

You need to compare a value with a field.

Secondly, this formula will have delegation warning.

Could you tell me how many are your records?

If your record is less than 500, there's no problem.

 If your record is larger than 500 and smaller than 2000, please change your non-delegateable limit to 2000.

If your record is larger than 2000, please modify your formula to delegateable functions. Or else you will get wrong result.

You could refer this in details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: LookUp last entry submitted by User

My idea is below. Notice that I have sorted the Driver Activity log in such a way that the most recent entries are at the top of the dataset. This ensures LOOKUP is retrieving the correct info.

LookUp(
Sort('Driver Activity Log', ID, Descending),
Email=User().Email,
‘Site LookUp’
)

I chose to LOOKUP in a column called Email that doesn’t exist in your dataset yet. You’ll have to add it.

I think the warning sign is showing because your formula cannot delegated due to including a dates data type. Some data types/functions can be delegated in SharePoint and others cannot. More info here: https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
Highlighted
Community Support
Community Support

Re: LookUp last entry submitted by User

Hi @TorreyFalconer ,

Firstly, Date is a fieldname, First('Driver Activity Log') is a record, you can not compare a field with a record.

Try this:

LookUp('Driver Activity Log',Date=First('Driver Activity Log').Date,'Site Lookup')

You need to compare a value with a field.

Secondly, this formula will have delegation warning.

Could you tell me how many are your records?

If your record is less than 500, there's no problem.

 If your record is larger than 500 and smaller than 2000, please change your non-delegateable limit to 2000.

If your record is larger than 2000, please modify your formula to delegateable functions. Or else you will get wrong result.

You could refer this in details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,093)