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

Display Data from a SharePoint List field in Relation to Date

I want to be able to display a PDF link when the date (day and month) in a SharePoint list column equals today's date.

 

SharePoint List Example

TitleFileLocationFilenameDayMonth
File Titlesharepointwebsitelinkdotcomfiletitle.pdf1-Jan

 

Search list and find the file that matches today's date.

6 REPLIES 6
Super User
Super User

Re: Display Data from a SharePoint List field in Relation to Date

@dmac73 

Put this code inside a button and it will provide a link to the first file matching the current date

Launch(
    LookUp(
        Sort(your_datasource_name,DayMonth,Descending),
        Year(DayMonth)=Year(Today())
        &&Month(DayMonth)=Month(Today())
        &&Day(DayMonth)=Day(Today()),
        FileLocation
    )
)

 

You are going to get delegation warnings here.  SharePoint lists currently do not support delegation for dates (yet) so my best attempt to get around this is sorting the list by DayMonth from newest to oldest so that the most recent files come first.

 

To test the solution you will need the file to have a DayMonth of 12/6/2019.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

Super User
Super User

Re: Display Data from a SharePoint List field in Relation to Date

Heya!

 

There's two other ways to get around delegation for Dates in Sharepoint 😺

 

1. Create a new Sharepoint number field, call it DateNumber, make it 20191131 i.e Value(Text(DateValueThing.Text, "YYYYMMDD"))

    Check against that number:

Launch(
    LookUp(
        Sort(your_datasource_name,DayMonth,Descending),
        DateNumber = Value(Text(Today(), "YYYYMMDD")),
        FileLocation
    )
)

 

2. Create and write three separate text fields for Year/Month/Day in your list, as checks against these are always delegable

Launch(
    LookUp(
        Sort(your_datasource_name,DayMonth,Descending),
        YearText=Text(Year(Today()))
        &&MonthText=Text(Month(Today()))
        &&DayText=Text(Day(Today())),
        FileLocation
    )
)

 

Cheers,

ManCat 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
Super User
Super User

Re: Display Data from a SharePoint List field in Relation to Date

@iAm_ManCat to the rescue with a delegation compliant solution!

Super User
Super User

Re: Display Data from a SharePoint List field in Relation to Date

Always Happy to Help 🙂

Plus I deal 100% in SharePoint at the moment, so I have to be a delegation guru 😹




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
dmac73
Level: Powered On

Re: Display Data from a SharePoint List field in Relation to Date

Great solution! Thank you.

 

Is it possible to do a search and ONLY compare the month/day? I am trying to make this not specific to a year. Another words, it will work each year without changing any list data.

Super User
Super User

Re: Display Data from a SharePoint List field in Relation to Date

Yes, you could remove the Year part in my second example, or set the Date format to "mmdd" and compare against that in the first example, but then you will potentially end up with multiple results being shown if there is more than one row that matches? If that's ok then try adding some test data in and see if it gives you the results you need 😺




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

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 (9,759)