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

Trying to use Lookup with 2 specifications

Hello everybody,

I'm trying to display something simple using Lookup on a SharePoint document library. This library is a repository where versions of a particular pdf are being sent, and I'm trying to display the document with the most recent file name.

Users select from a dropdown that specifies which workflow ID they're looking at. It's very basic and works fine until I have two documents with the same WAMIncrementedID in that library...then it only looks at the original one. I need to figure out a way to show the name of the most recently uploaded document rather than the original document. I've tried adding an ID column which would differentiate the two, but I can't figure out how to lookup two things.

Here's my current setup:

app1.PNGSimple dropdown that displays name

app2.PNGSimple lookup

This is working the way it's supposed to, but I need to not only lookup the name, but the max ID of the most recent document added to the library:

app3.PNGTrying to display the file name in the red box.

I've tried adding something like "&& Max(ID)" after the '{Name}' in my equation, but it isn't working. Any ideas on how I can achieve this?

Thank you!

Daniel

 

1 ACCEPTED SOLUTION

Accepted Solutions
PauwelsSven
Level 8

Re: Trying to use Lookup with 2 specifications

Hi,

 

Try this formula instead:

Text(First(SortByColumns(Filter(WAMWorkflowDocs, WAMIncrementedID = ActiveWorkflowIDDropdwon_1.Selected.Value), "ID", SortOrder.Ascending)).Name)

Hope this helps

Regards.

4 REPLIES 4
MRNBagtas
Level: Powered On

Re: Trying to use Lookup with 2 specifications

Hi, @adaptivecruise!

 

Have you tried using sort and first functions of powerapps?

 

something like this:

 

First(Sort(*Your lookup function*,ID,Descending))

 

** Sort by ID - to ensure that the latest one is on the top of the table

** First - to get the first record in the table

 

I hope this helps Smiley Happy 

Community Support Team
Community Support Team

Re: Trying to use Lookup with 2 specifications

Hi @adaptivecruise,

Based on needs that you mentioned, I think the LookUp function may not achieve your needs.

As an alternative solution, I have made a test, please take a try with the following workaround:

Set the Default property of the Text Input control to following:

First(
Filter(
SortByColumns(WAMWorkflowDocs, "ID", Descending),
WAMIncrementedID = ActiveWorkflowIDDropdown_1.Selected.Value
)
).'{Name}'

More details about Filter function and First function, please check the following article:

Filter function

First function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PauwelsSven
Level 8

Re: Trying to use Lookup with 2 specifications

Hi,

 

Try this formula instead:

Text(First(SortByColumns(Filter(WAMWorkflowDocs, WAMIncrementedID = ActiveWorkflowIDDropdwon_1.Selected.Value), "ID", SortOrder.Ascending)).Name)

Hope this helps

Regards.

adaptivecruise
Level: Powered On

Re: Trying to use Lookup with 2 specifications

Hey everybody! 

 

The solution offered by @PauwelsSven seems to be working best for my purposes. Working like a charm!

 

Can't thank you enough for your help on this one! You all rule.

 

Daniel

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 50 members 3,950 guests
Please welcome our newest community members: