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 AX (Archived)

How to select data for Privious Week and for Next week in AX 2012?

(0) ShareShare
ReportReport
Posted on by 865

I develop a form, in that form 3 buttons are their----- PREVIOUS WEEK, CURRENT WEEK, NEXT WEEK. this are 3 buttons, If I click on PREVIOUS WEEK button then from Monday to saturday of last week data should come, same if I click on NEXT WEEK then from monday to saturday of next week data should come. same as for CURRENT WEEK, How can I write code for this??

*This post is locked for comments

I have the same question (0)
  • David Massey Profile Picture
    on at

    You are making the asumption that week starts on Monday.  Not necessarily a good asumption. Portions of the application let you define the week start date.  Timesheets is an example of the user being able to determine when the work week starts.

    Use SysQueryRangeUtil::dateRange() with a combination of parameters like dateStartWeek(), dateEndWeek() to define the query range for the date field.

  • Viral Suthar Profile Picture
    279 on at

    write a logic in button's click method

    use following method to get start and end date of current week...

    for start date

    global::dateStartWk(systemdateget());

    for end date

    global::dateEndWk(systemdateget());

    store that dates in two variable..

    call the method which is fetch up your data....

    and pass that values of variable as parameter in that method

    use same logic to get last and next week dates and pass that value again in same method...

    if still you have any doubt then reply me..

    thank you

  • Akshay Bankar Profile Picture
    865 on at

    Hi Viral.

    Your code is working finely, but as per requirement I want to compaire dates from the AOS date.

    Means,

    in Organization administration-Area page-Common-Calendars-DateDimensions

    here if I select the start day of week as Thursday then that button For previous week, next week and current week should work for that start day not from system date.

  • Viral Suthar Profile Picture
    279 on at

    Hi,

    Glad to have your reply akshay,

    if i understood the sceanario then,

    if start day of week is thursday &

    today is monday = 24/9/2012

    then  current week is 20/9/2012 to 26/9/2012

             last week is 13/9/2012 to 19/9/2012

             next week is 27/9/2012 to 04/09/2012

    am i right??

    reply soon then i will give you the logic........

  • Akshay Bankar Profile Picture
    865 on at

    Yes Exactly Viral,

    Requirement is the same as you mentioned above.

  • Viral Suthar Profile Picture
    279 on at

    some how i am not able to reply my logic dont know why can you give me your email id so i can share the logic with you.....

  • Akshay Bankar Profile Picture
    865 on at

    Hi viral,

    please send it on bankarakshay@gmail.com

    Thanks Viral,

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans