How do I set default date or time in Navision table( date/ t

manuvmanuv Member Posts: 5
How do I set default date or time in Navision table( date/ time type field)

Comments

  • garakgarak Member Posts: 3,263
    edited 2009-07-14
    Could you explain a liitle bit more what you want to do?

    DateField := 31121977D; //or workdate or today <- both are system constants
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    what do you mean by default date & time - you mean like an start date I would put code OnInsert or the table.
    example//
    OnInsert()
    "Start Date" := TODAY;

    OnModify()
    "Date Modified" := TODAY;

    in this example "start date" & "date modified" are the fields you want to have updated when an action occurs.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Tools>Workdate.
    David Singleton
  • garakgarak Member Posts: 3,263
    thats set not the default date in Navision table. Per defaul the initvalue is 0D and this is (on SQL the 1753-01-01 00:00:00.000)
    That set the default date for, for example, document dates on order. but not for all date fields.

    The question is: what will manuv do :?: (Maybe the workdate is all what he need?)

    PS: With "T" in a datefield you get the Systemdate (T-> Today) and with a "W" you get the workdate (how to set the workdate has David described)

    Regards
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    garak wrote:
    PS: With "T" in a datefield you get the Systemdate (T-> Today) and with a "W" you get the workdate

    Not on Tuesdays and Wednesdays you don't :shock:
    David Singleton
  • garakgarak Member Posts: 3,263
    ;-) in my local Database (german) i have not these probs.

    H -> Heute (Today)
    A- > Arbeitsdatum (Workdate)

    And there is no weekday that begins with an H or A :-)

    But: when i change the language to English and i press "W", it use the changed workdate, if i press T it use the systemdate.
    So, is it really so in your database that the T and the W is not the default for Today / Workdate. In my it is the default.
    "Tu" or "Th" are for Tuesday / thursday and We for Wednesday.

    regards
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    garak wrote:
    ;-) in my local Database (german) i have not these probs.

    H -> Heute (Today)
    A- > Arbeitsdatum (Workdate)

    And there is no weekday that begins with an H or A :-)

    But: when i change the language to English and i press "W", it use the changed workdate, if i press T it use the systemdate.
    So, is it really so in your database that the T and the W is not the default for Today / Workdate. In my it is the default.
    "Tu" or "Th" are for Tuesday / thursday and We for Wednesday.

    regards

    Only sometimes :mrgreen:
    David Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Try this in a US version of Navision.

    Open a report or form any where you can enter a date filter:

    enter : ..t <t ..w <w

    then try tomorrow and again next tuesday. I really can't remember the combinations and results, but I know they will be wrong.
    David Singleton
  • manuvmanuv Member Posts: 5
    Thank you for all the immediate responses.
    All the above answers partially or completely agreeing my experiments.

    This is my situation. I already resolved the issue, but I like to share my experiments, thanks.
    One of my Navision 2009 table (Sql server 2005) partially updated by Navision program and partially by an external application (VB 2008 and SQL connection)
    So what I understood from all my testing are, Navision table column settings (Object designer Table Design  select the column  Properties) (Eg: InitValue, Blank Number etc ) has no effect on actual SQL table init settings (in SQL SERVER) . For example, Navision does not allow NULL values, so to replace the null value update from an external application you have 2 options
    1 option is programmatically check Navision compatible test before update
    2 option is preset the default property of the table columns with Navision type column initialization values (varchar ‘’, DateTime  ‘1753-01-01 00:00:00.000’ etc ) in SQL SERVER ; only update the required fields not all the fields when using INSERT/UPDATE SQL statements from external applications

    If you are interested we can discuss in details thanks
  • garakgarak Member Posts: 3,263
    So, if an external Application, like an php script or a C++ programm, writes datas in a NAV table where a Date is set,
    these programm must fill the datefield with the value: 1753-01-01 00:00:00.000.

    the reason: No Field could be NULL
    Do you make it right, it works too!
  • manuvmanuv Member Posts: 5
    An external applicaton can write any information into the Sql Table as long as it follows the rules of SQL Server/ Table/Column Type. Sql Server Table/Column does not care about the Navision Rules set inside the Nav Program. The issue is when you try to open the same table inside Navision, then Navision will not allow you to open the table; it will give you some invalid data error, if it finds some invaild navision type data in the table. That is why I said, before update (insert/update) any values from external application into the Sql server (Navision table) you should programatically test the navision validity of the data.
Sign In or Register to comment.