Getting Number of Months

FreakyFreaky Member Posts: 125
Hi Guys,
Can anyone help me on how I can get the number of months when I filter by posting date from let say 010108..t

Thanks in advance.

Answers

  • kapamaroukapamarou Member Posts: 1,152
    You could apply your filter on the Date table with type Month and count the record... :whistle:
  • FreakyFreaky Member Posts: 125
    This is the code that I have, but it is not doing the logic
        Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
        Calendar.SETRANGE("Period Start","Posting Date");
       Months := Calendar.COUNT -1;
    


    Months - Counts the Number of Months

    Thanks.
  • kapamaroukapamarou Member Posts: 1,152
    You should say:
    Calendar.SETRANGE("Period Start",FromDate,ToDate);

    or

    Calendar.SETFILTER("Period Start",GETFILTER("Posting Date"));

    Now you are applying the "Posting Date" as a filter.

    But you'll need to think it over. For Example if you say 02/Jan/2009..30/Sep/2009 how many months do you consider this to be?
  • FreakyFreaky Member Posts: 125
    Thanks for your help..
  • kapamaroukapamarou Member Posts: 1,152
    You're welcome.
Sign In or Register to comment.