CALCATE and DATEFORMULA in NAS

rkaufmannrkaufmann Member Posts: 71
Hi,

I have a problem over here.
We are running on a german Version of 4.0 SP3.

I just have created a Codeunit to run scheduled jobs periodically in NAS.
No problem so far.

To calculate the next execution for a planned job, I use CALCDATE in the codeunit like this:
NextExecutionDate := CALCDATE('+7T',LastExecutionDate);

The '+7T' is the writing to use in a german environment. It corresponds to <+7D> in an english environment.

When the NAS is executing this code, I get an error in the Eventlog, that '+7T' is not a valid expression.

When starting the codeunit in a "normal" Nav Client, everything works fine.

It seems, that NAS is not recognizing the used regional settings or language.

How can I get this to work?

Regards,
Rolf

Answers

  • danlindstromdanlindstrom Member Posts: 130
    NAS is running like an english client!

    use <+7D>

    If same code is shared with normal clients use
    IF GUIALLOWED THEN
    NextExecutionDate := CALCDATE('+7T',LastExecutionDate) //Client
    ELSE
    NextExecutionDate := CALCDATE('+7D',LastExecutionDate); //NAS
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • rkaufmannrkaufmann Member Posts: 71
    I did some testing and found out the following:
    NextExecutionDate := CALCDATE('<+7D>',LastExecutionDate);
    
    works allways, also in german clients.

    Using Database-Fields of type "DateFormula" also works.
    Dateformulas like '+7T' stored in a DateFormula-Field also work in NAS.

    But much better would be, if I could tell NAS to behave as a localized client, because now I have to search code of many objects for CALCDATE-Statements and have to replace them with the english Dateformulas.
  • kinekine Member Posts: 12,562
    rkaufmann wrote:
    I did some testing and found out the following:
    NextExecutionDate := CALCDATE('<+7D>',LastExecutionDate);
    
    works allways, also in german clients.

    Using Database-Fields of type "DateFormula" also works.
    Dateformulas like '+7T' stored in a DateFormula-Field also work in NAS.

    But much better would be, if I could tell NAS to behave as a localized client, because now I have to search code of many objects for CALCDATE-Statements and have to replace them with the english Dateformulas.

    Yes, this is the cost of "wrong" development. You know, when developing for NAV, develop all in English and with thinking about multilanguage... :-)

    Yes, the <xxx> is working for all languages. It is a must when using "magic constants" in your code.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.