How to get ServerDate in NAV?

chandrurecchandrurec Member Posts: 560
Hi all,

I want to get the server date in navision.Generally if I give today I will get the seystem date of the current pc I am working with but not the server date. For getting the server date , is there any keyword available in NAV?

Thanks in advance.

Regards,
Chandru.

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    No.
    David Singleton
  • kinekine Member Posts: 12,562
    Just search the forum. The answer is there fo last 4 or 5 years I think. Since you can create view on SQL server and link it into NAV table, it is easy to do something like that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • chandrurecchandrurec Member Posts: 560
    Hi Kine,

    I have followed the steps as given below.
    creat this view on the ms sql in your Navision Database:

    CREATE VIEW dbo.ServerDateTime_View
    AS
    SELECT '' AS PK, GETUTCDATE() AS ServerDateTime
    ORDER BY ''

    Create new table in Navision with same name as the view (you can use another
    name in the view),
    create two fields:

    1 PK Code 20
    2 ServerDateTime DateTime

    Set properties:
    DataPerCompany = No
    LinkedObject = Yes

    Save the table. If you make SDT.GET; (SDT is variable of type Record for
    your new table) you have in field SDT.ServerDateTime the server date and
    time...

    The field PK is there only as simulation of Primary key to be able to make
    GET for this table...

    But when I run the table , it is giving the error "TableData 50000 does not exist".

    If you know how to rectify this error , kindly let me know.

    Thanks in advance.

    Regards,
    chandru.
  • ChinmoyChinmoy Member Posts: 359
    Hi Chandru,

    All the names should be exactly same. Say if you have created the view with name, SDateTimeView, and the fields as PK and SDateTime, you have to use the same names when creating the Navision table in object designer, else this concept will not work.

    I hope this will solve your problem.

    Note: please delete the table from object designer and re-create.

    Cheers!

    Chn
Sign In or Register to comment.