Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)
Posted on by 3,027

Hi

    I have Date on a form . I want to filter record on basis of date . What should i use Setrange or SetFilter. User can enter single Date like 02042018 or also in Range like 02042018..10042018.

Thanks

*This post is locked for comments

  • Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Date

    Hi,

    Trying passing the date as 01/01/2017..31/01/2017

    It could be probably because 01012017 cannot be decoded to 01/01/2017 as it is a text field.

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Date

    Hi Jsshivalik,

    In this case, you should have a Text on a form (instead of Date). OnValidate the text field, write some code to parse date filter and update it back.

    Take a look at table 8626 Config. Package Filter to see how Microsoft Developer did it, very nice.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Date

    Is that a Text Variable where they entering the value or a flow filter ? can you send us the screenshot and let us know the source of the field you added on the form.

    What is "Date Filter"

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Date

    Hi Suresh

       It is giving error "Type Conversion is not possible because one of the Operators contain an Invalid Type" Text:= Date

    TrEntry.SETFILTER(TrEntry.Date,GETFILTER("Date Filter");

    Date Entered is like this 01012017..31012017

    Thanks

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Date

    I believe the datefilter you have added is the text, you could add something like this and use the SETFILTER

    IF DateFilter <> '' THEN

           TrEntry.SETFILTER(Date,DateFilter);

  • Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Date

    I jsshivalik,

    Try using two field say StartDate and EndDate

    Now use,

    IF EndDate = 0D then

    TrEntry.SETFILTER(TrEntry.Date,'%1',StartDate);

    ELSE

    TrEntry.SETFILTER(TrEntry.Date,'%1..%2',StartDate,EndDate);

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Date

    Hi

        User cannot leave date blank. I have written below code but is giving error "Type Conversion is not possible because one of the Operators contain an Invalid Type" Text:= Date

    TrEntry.SETFILTER(TrEntry.Date,DocumentDate);

    Thanks

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Date

    You can use setrange but if user not put any of the date then which date program will pickup.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans