Skip days on a matrix form

AlishaAlisha Member Posts: 217
Hi,

Anyone know how can I skip certain days on a matrix form? For example for not showing the saturday/sunday columns..

Thanks!

Comments

  • matttraxmatttrax Member Posts: 2,309
    You can check to see what day of the week it is using

    DATE2DWY(YourDate, 2);

    It returns an integer (1 = Monday, 2 = Tuesday...6 = Saturday, 7 = Sunday). You can read more about it in the Navision help.

    From there you can have logic that decided whether or not to skip the date.
  • sander7sander7 Member Posts: 10
    Hi Alisha,

    This can be done using filters.

    Codeunit 359 is used to control wich columns are presented, and this is the one You might want to modify.

    If You want never to be able to present Saturdays or Sundays (wich is a bit too much, if You ask me) it can easily be obtained by adding these 2 lines of code:
    IF PeriodType = PeriodType::Day THEN
      Calendar.SETRANGE("Period No.",1,5);
    

    just after SETRANGE has been done to "Period Type", in both "FindDate"- and "NextDate"-functions in the codeunit.

    I will urge You to come up wth a more neat solution, perhaps by implementing one more value (say 'Day(5)') to the option-string in the PeriodType-parameter in the functions.
    Or if this request is only needed on new forms, create "dublicate" functions in codeunit 359, where You add the extra option-value, and then call these functions from Your form instead. This will make future upgrades easier.

    Regards
    Alexander Pallesen
    Freelance Developer - Navision
    Regards,

    Alexander Pallesen
    Freelance Navision Developer
Sign In or Register to comment.