Updating date

Hanen_THanen_T Member Posts: 32
Hello,

How can I keep a field date uptodate. My field is a result of calcdate(Lead Time Calculation,workdate);
I want to have at anytime the right value on this field.


Thank you #-o
Technico-Functional Consultant NAV
It's all about passion of Navision World

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Try by adding the below code in Item Card Form - OnAfterGetRecord() and Item Table Lead Time Calculation - OnValidate() triggers
    Uptodate := CALCDATE("Lead Time Calculation",WORKDATE);
    

    Uptodate is a Date type field in Item table
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Try by adding the below code in Item Card Form - OnAfterGetRecord() and Item Table Lead Time Calculation - OnValidate() triggers
    Uptodate := CALCDATE("Lead Time Calculation",WORKDATE);
    

    Uptodate is a Date type field in Item table


    Simpler is just to add this as the source expression of the control. The problem is that if you get an error you wont be able to then open the form.
    David Singleton
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Try by adding the below code in Item Card Form - OnAfterGetRecord() and Item Table Lead Time Calculation - OnValidate() triggers
    Uptodate := CALCDATE("Lead Time Calculation",WORKDATE);
    

    Uptodate is a Date type field in Item table


    Simpler is just to add this as the source expression of the control. The problem is that if you get an error you wont be able to then open the form.

    You are right.. :thumbsup:
    and we dont need a new field also :wink:
  • Hanen_THanen_T Member Posts: 32
    Thank you but just one more thing where will I put this Uptodate := CALCDATE("Lead Time Calculation",WORKDATE); on which trigger???
    I will need this field to calculate a new field copy of invetory but wher the posting date is < my new field (Uptodate := CALCDATE("Lead Time Calculation",WORKDATE));
    Technico-Functional Consultant NAV
    It's all about passion of Navision World
  • Hanen_THanen_T Member Posts: 32
    It didn't work, I have the right value on the form and not on the item table :oops:
    Technico-Functional Consultant NAV
    It's all about passion of Navision World
  • vaprogvaprog Member Posts: 1,139
    If you want it in the Iten table then create a function in the table object and use it as it it was a read only field.
    You cannot keep a real database field current. You can approximate "current" by running batch jobs, or make it current by using a function.
Sign In or Register to comment.