web
You’re offline. This is a read only version of the page.
close
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
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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans