microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
388 stars 341 forks source link

Make list web part hidden if there is no element #4067

Closed madslmoeller closed 3 weeks ago

madslmoeller commented 4 weeks ago

Hi

I'm new to the M365 universe and SharePoint, but I'm currently trying to implement a PnP search feature that allows me to show Alerts (messages) from a list, but in that way, that it should stay hidden if there isn't any based on the end date. Is this a existing feature and if so, how do I implement that? Any documentation?

kasperbolarsen commented 4 weeks ago

Hej Mads

This is one of the options in the Results web parts. It is on "page" 2 in the configuration, https://microsoft-search.github.io/pnp-modern-search/usage/search-results/layouts/

madslmoeller commented 4 weeks ago

Thanks Kasper, I will take a look at the link documentation!

madslmoeller commented 4 weeks ago

Hi Kasper

Would you be able to help due to sorting by end date? (if possible). In {searchTerms} I already got {searchTerms} path:https://test.sharepoint.com/sites/Intranet/Lists/Alerts to find my list og alerts. I would assume I need the "AND" operator but I don't know how to define that it only should show the alerts of today's date and should be removed again on the end date of the alert.

kasperbolarsen commented 3 weeks ago

If you want to query a specific date range, the KQL docs here has a few great samples, https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference?redirectedfrom=MSDN

If you want to sort the results, see the sort settings section here https://microsoft-search.github.io/pnp-modern-search/usage/search-results/data-sources/