cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Select latest date and time in Gallery

Hey guys,

How are you doing? I hope you're all doing well.

 

I have a gallery and there are records which are added if I press a button. If a record is added, the date and time are added, too.

 

I want that the selection jumps to the location where the last record is added.

 

Example:

 

TemplateFill:

If(ThisItem.IsSelected; Gray)

Here the selection jumps to the location where I clicked.

 

But I'd like to achieve this:

If(ThisItem.'Erstellt am' = Filter(CDSSource, 'Erstellt am' = First(Sort(Distinct(CDSSource, 'Erstellt am'), Result, Descending)).Result), Gray)

'Erstellt am' means 'Created on'.

 

But following error message appears: Invalid argument type.

I know it is about wrong data types are being set and the if condition is not able to compare properly.

 

But how to change the code that it is working?

 

Thanks so much for helping.

 

ThePowerAppsGuy

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
eka24
Super User
Super User

If you want the latest date time selected, Sort should work for you. On Items of the Gallery;

Sort(CDSAource,'Erstellt am', Descending)

 

This will ensure the latest is always selected.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Anonymous
Not applicable

Solution as well for TemplateFill property of the gallery:

 

If(ThisItem.'Erstellt am' = LookUp(Sort(CDSSource; 'Erstellt am'; Descending); Mail = EmployeeComboBox.Selected.UserPrincipalName; 'Erstellt am'); Gray)

 

 

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

If you want the latest date time selected, Sort should work for you. On Items of the Gallery;

Sort(CDSAource,'Erstellt am', Descending)

 

This will ensure the latest is always selected.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Anonymous
Not applicable

Solution as well for TemplateFill property of the gallery:

 

If(ThisItem.'Erstellt am' = LookUp(Sort(CDSSource; 'Erstellt am'; Descending); Mail = EmployeeComboBox.Selected.UserPrincipalName; 'Erstellt am'); Gray)

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,273)