Skip to main content

Notifications

Announcements

No record found.

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
  • Suggested answer
    Avinash B Profile Picture
    1,455 on at
    RE: Filtering records on basis of date fields in listpart

    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 499 Super User 2025 Season 1

#2
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 376

#3
Mansi Soni Profile Picture

Mansi Soni 347

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans