Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

filter a form with date filter using combo box in X++

(0) ShareShare
ReportReport
Posted on by 100

Hi Experts,
I want to open a form with Date filter  (today+1 ) using combo box .
This Datefilter (combo box) will  filter my Date field of custom form having only one DataSource.

I have created a combo box in form .
how to write logic for this condition.5824.Capture.PNG 

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,550 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    It would be because you added date range of minimum value to Today + 1. As per your requirement, it was just Today + 1 on initialization. Please check the code I shared before and modify your date range value.

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    I thought it would be hard to detect since you didn't set first value to the control, but I noticed something different.

    Do you only want the records for tomorrow or the records until tomorrow? (You filtered single day in Modified, but you used range in init)

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    Set control value at init

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: filter a form with date filter using combo box in X++

    Just last thing.

    filter of today+1 is not working, while opening the form.

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    At modified use this.dateValue( not DateControl)

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,550 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    Issue still seems to be with your date control, you can create new form control of type date, set EDT as TransDate. Override modified and use the code there.

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: filter a form with date filter using combo box in X++

    Thanks Mohit & Martin.

    Now the code is working fine .

    Thankyou so much ..

  • Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    RE: filter a form with date filter using combo box in X++

    I would start by changing DateControl.dateValue() to this.dateValue().

  • HARISH MEHRA Profile Picture
    HARISH MEHRA 100 on at
    RE: filter a form with date filter using combo box in X++

    Hi Mohit,

    Moved my code to Data source init. 

    Now getting error in on modified of  Datecontrol

    4846.Capture4.PNG

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,550 Super User 2024 Season 1 on at
    RE: filter a form with date filter using combo box in X++

    It seems like you have placed the code in form init instead of Form Datasource init. If yes, then please move it to form Datasource init method.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans