web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Filtering records on basis of date fields in listpart

(0) ShareShare
ReportReport
Posted on by 305

Hi

I have a listpart control on my role center page with source table containing fields "ReturnDateTime" and "DueDateTime". I want to filter those records which have the condition ReturnDateTime > DueDateTime. I used SetFilter function in OnOpenPage trigger of the listpart as follows:

SetFilter(ReturnDateTime, '>%1', DueDateTime);
But it is not working. As far as I observed, it fetches the records which have values in the above fields and leaves the ones with empty values in them. It also brings records with ReturnDateTime lesser than DueDateTime which I don't need. Can someone please suggest what I am doing wrong?
Thanks in advance!
Regards
Khudeja
I have the same question (0)
  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    Hi

    if your record has both the fields "ReturnDateTime" and "DueDateTime", then the DueDateTime will also change per each record. May be due to that your filter is not working.

    I feel the DueDateTime should be fixed for the filter.

    Also to avoid empty values you can try the below code.

    SetFilter(ReturnDateTime, '>%1|<>%2', DueDateTime,0DT);

    Cheers

    Avinash B

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,687 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,041 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 974 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans