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 :
Microsoft Dynamics NAV (Archived)

Setrange

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

    I have Input Parameter as Posting Date in Report . I want to implement SetRange on 2 fields. If user enters Posting Date = 01/04.2017..31/05/2017 then Table should display only those records where (Posting Date is >= & <= Input Date) and (ReceiptDt is >= & <= Input Date)) .

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You can apply SETFILTER function instead for the two fields as follows.

    Record.SETFILTER("Posting Date", '%1', InputDate);

    Record.SETFILTER("Receipt Date", '%1', InputDate);

    Thanks.

    If my answer helped to resolve your issue, please verify the answer which will help our community members who are having similar kind of issues.

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     What is Input Date . I am accepting Date in Posting Date. In Posting Date user can enter 01042017..30042017

    Thanks

  • Suggested answer
    Community Member Profile Picture
    on at

    Input Date can be a range like 01042017..30042017 or a single day like 30042017.

  • Tina Menezes Profile Picture
    2,582 on at

    Hi

    You can either user setrange or setfilter

    Rec.SETFILTER("Posting Date",'>=071417D&<=072117D');

    Rec.SETRANGE("Posting Date",071417D,072117D);

    This will filter and display only those records which have posting date >= 14th July 2017 and <= 21st July 2017

    Instead of passing the dates directly like how I have written above, you have to add your field values.

  • jsshivalik Profile Picture
    3,099 on at

    Hi

      Do i need to create 2 separate variables (Start Date or End Date)  or with Posting Date Filter alone it can be done.

    I have one Input Condition if that is true then i want to filter records with Receipt Date on POsting Date Range. User may whatever enter in Receipt Date.

    Thanks

  • jsshivalik Profile Picture
    3,099 on at

    It can be range or it can be single day

  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    With your statement, it seems you are assuming that user will always enter a range in Input Date.

    You can start with an error message if user does not enter a range like -

    IF STRPOS(FORMAT(InputDate),'..') = 0 THEN

     ERROR('Input Date should contain date Range');

    After this what @hasitha says is correct. The Posting Date and Receipt date will be filter as you require.

  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    If its a single day then you can use two satement -

    IF STRPOS(FORMAT(InputDate),'..') = 0 THEN BEGIN   //Take Care of multiple values

      Record.SETFILTER("Posting Date", '%1', InputDate);

      Record.SETFILTER("Receipt Date", '%1', InputDate);

    END ELSE BEGIN                                                            //Take Care if single value.  

      Record.SETFILTER("Posting Date", '%1..%2',0D,InputDate);

      Record.SETFILTER("Receipt Date", '%1..%2',0D,InputDate);

    END

  • jsshivalik Profile Picture
    3,099 on at

    Hi

      My question is Do i need to create 2 separate variables or with POsting Date Filter it can be done. User can enter single Day or Range in Posting Date.

    Thanks

  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    The above solution will take care of both the cases.

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 > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans