cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TorreyFalconer
Helper IV
Helper IV

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
v-yutliu-msft
Community Support
Community Support

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
mdevaney
Super User III
Super User III

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.
v-yutliu-msft
Community Support
Community Support

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (65,022)