cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TorreyFalconer
Level: Powered On

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
Community Support Team
Community Support Team

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
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.
Community Support Team
Community Support Team

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,362)