Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to use the field codings from Macropods excellent document DateCalc v 2.80

    When I use the code example for 'Calculate a day, date month and year, using n days delay' it works very well. The value for Delay I then take from a Dropdown field with a list of four different values. Works well.

    But when I try to use the field codes for modifying if a calculated day falls on a weekend or holiday I got stuck. Even if I donīt change anything in the original documents coding it stops on Tuesday, 24 November 2009 when I update by pressing F9. The Delay in the original code is set to 10 so I canīt understand other than there must be someting wrong.

    Can this depend on my computers regional settings which is for date: yyyy-MM-dd (Sweden) ? Where to change if so? In the field code? In the last code-raw or in more places?

    I donīt see what is wrong. Have already changed the holidays in the code to suite Swedish calender, and think I got them right, but the problem seems to view already when my computer handles the original code...

    Any hints?

    /Silfver

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    If you toggle field codes to be visible (Alt+F9), you'll see {dd}-{mm}-{yy} near the end of almost every item. You should change this to {yy}-{mm}-{dd} for Sweden. Keep in mind that you shouldn't type the field braces {} yourself, instead press Ctrl+F9 to insert them (or copy and paste an existing set of braces). After toggling field codes off (Alt+F9 again), select the field and press F9 to update it.

  3. #3
    New Lounger
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have tried that, but I got a wrong date viewed.

    And I have tried "{yy}-{MM}-{dd}" \@ "yyyy-MM-dd" too... The field then show when updated: -4713-11-24

    And "{yyyy}-{MM}-{dd}" \@ "yyyy-MM-dd" Seems to give the right date format adapted for regional settings in Swedish computers.

    But when I select the field and update I get: 2009-11-24 with the code for 'Following Monday'

    Why does the code count like that?

    /Silfver

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You shouldn't use {yyyy} instead of {yy} - the yy here is not a format but the name of a bookmark defined earlier within the field code.

    I cannot tell you why it doesn't work correctly with yyyy-mm-dd date formatting; I hope that macropod will be able to help you.

    (In the meantime, these calculations are a lot easier in Excel than in Word. Word wasn't really intended for this kind of thing)

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='Silfver' post='776888' date='26-May-2009 05:57']Have tried that, but I got a wrong date viewed.

    And I have tried "{yy}-{MM}-{dd}" \@ "yyyy-MM-dd" too... The field then show when updated: -4713-11-24

    And "{yyyy}-{MM}-{dd}" \@ "yyyy-MM-dd" Seems to give the right date format adapted for regional settings in Swedish computers.

    But when I select the field and update I get: 2009-11-24 with the code for 'Following Monday'

    Why does the code count like that?

    /Silfver[/quote]
    Hi Silfver,

    Because of the way your system is set up, you'll need to change the two commas on the line:
    {SET jd{=jd+(MOD(jd,7)>4)*(7-MOD(jd,7))}}
    to semi-colons, thus:
    {SET jd{=jd+(MOD(jd;7)>4)*(7-MOD(jd;7))}}
    along with changing the last line to:
    "{yy}-{mm}-{dd}" \@ "yyyy-MM-dd"}
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •