Calculate week of a month

supriyomukherjeesupriyomukherjee Member Posts: 6
I have created a table with following fields and data:

Start Date: 01/05/10
End Date: 31/05/10
Holiday: Thursday
Week of Holiday: 1 or 2 (Any One)
Date1: ??????
Date2: ??????

Now if I entered the same data as mentioned above and if the Week of Hodiday is 1 then the Date1 and Date2 will return the 1st and 3rd date of Thursday (field-Hodilay) and if Week of Hodiday is 2 then the Date1 and Date2 will return the 2nd and 4th date of Thursday of the particular month as given in Start Date and End Date fields.

Can anyone help me out immediately.

Comments

  • BeliasBelias Member Posts: 2,998
    can you rewrite your question? maybe i am the only one, but i didn't understand your question at all...what do you want to do?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • SogSog Member Posts: 1,023
    If you try to create a calendar with recurring holiday's, why don't you use the standard calendar tables in NAV?
    They should be sufficient.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • supriyomukherjeesupriyomukherjee Member Posts: 6
    Actually, I want to set holiday for a particular employee.

    Example: I
    Suppose if you set
    Start Date: 01/05/10
    End Date: 31/05/10
    Holiday: Saturday
    Week of Holiday: 1
    The Date1 and Date2 will return a 01/05/10 and 15/05/10 based on the 1st and 3rd Thursday of the month.

    Example: II
    Suppose if you set
    Start Date: 01/05/10
    End Date: 31/05/10
    Holiday: Saturday
    Week of Holiday: 2
    The Date1 and Date2 will return a 08/05/10 and 22/05/10 based on the 2nd and 4th Thursday of the month.

    Note: An Employee will get max. 2 days leave in a month
  • BeliasBelias Member Posts: 2,998
    :-k sorry, i can't get it...what's the logic behind it?
    What is "week of holiday"? and "holiday"?I mean...You set saturday, one week, why do you extract the first and third thurdsay of the month?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • supriyomukherjeesupriyomukherjee Member Posts: 6
    Sorry, It will be Saturday and not Thursday
  • SogSog Member Posts: 1,023
    Then why don't you use the customised calendar (based on base calendar) together with employee and put constraints in the holiday onvalidate. You don't have to invent hot water twice.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
Sign In or Register to comment.