Creating date regarding to computer's system date

mark_christsmark_christs Member Posts: 156
Dear All,
I have created a field in a new created form with a sourcetable is from an existing table but it is a table line not header's table, I create new field last date modified like in the header and the type is date, but after I run the new form, I can't see the field last modified date is filled, although I close and open repeatedly. I also want to capture computer's system date in a new field called current date and I write in the C/AL global, but I can't also see the date filled, I am really doubt..any answers are welcome and thanks.


Rgds,
Mark

Comments

  • kinekine Member Posts: 12,562
    Ok, you created some field and added this field to the form. But, how you are filling this field? I do not understand what you did and what you want to do...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mark_christsmark_christs Member Posts: 156
    Dear Kine,
    tks for your prompt reply. I don't know why you don't understand but nevermind I will describe as follows (but this is only example):
    1. I open table production order line, I add new field called last modified date field (abbreviated : x field) with data type is date
    2. create a new form using subform type from toolbox.
    3. Using field menu, I look for the x field and put it into the new form, in the subform (the new form's source table is production order line that known and taken from field menu).

    but when I run my new form but the last modified date is still empty, although, I close the form and then open it again., ](*,) ](*,)

    any answers are welcome and tks.


    Rgds,
    Mark
  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    Hej Mark_Christ
    You still do not answer Kine's question: How do you fill in date in the field.

    E.g.: To update the date each time a record is modified, you have to put (something like the) following code on the tables OnModify-trigger:
    "x" := WORKDATE;
    With Kind Regards
    Thoms Hviid Thorn
  • mark_christsmark_christs Member Posts: 156
    Dear All, Thomas,
    Tks for your prompt reply. Actually I want the date must same as the date in the computer/navision work date and filled in automatically, sorry for this mis answer. I don't exactly how to do this.. ](*,) :?:


    Rgds,
    Mark
  • kinekine Member Posts: 12,562
    edited 2006-04-25
    In this case, if you want to see just computer date, you do not need any new field in your table. You just need to add new edit box into your form and set source to TODAY or CURRENTDATETIME or TIME (depend on what you want, date, date and time or just time). Or if you want workdate then source will be WORKDATE.

    But if you want to keep the workdate in the table, it means it will be something like "WORKDATE" when the record was inserted. Or modified etc... in this case you need to fill the date in apropriate trigger...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    Hej Mark,

    I might sound nosy - but checking the F1-online help for these subjects will be the easiest way for you to carry on!
    With Kind Regards
    Thoms Hviid Thorn
  • mark_christsmark_christs Member Posts: 156
    Dear All,
    Tks again for your prompt reply, basically I don't know where to put this
    "x" := WORKDATE, I've tried to put here but not work:
    OnModify()
    IF Status = Status::Finished THEN
    ERROR(Text000,Status,TABLECAPTION);
    "System Date" :=WORKDATE;
    ReserveProdOrderLine.VerifyChange(Rec,xRec);

    in table ID 5406.


    rgds,
    Mark
  • kinekine Member Posts: 12,562
    Yes, this will update the field if someone change the record. You need to "touch" the record to have the field filled...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mark_christsmark_christs Member Posts: 156
    Dear Kine, All,
    It still doesn't work because the form I created is as same as the CPOS (Change Production Order Status) form (form ID 99000914), what do you think ?


    Rgds,
    Mark
  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    Hi Mark,

    Something occurred to me: Are you sure you are modifying - and not renaming ?? Try and put the code on the OnRename-trigger to.

    Else when I'm stucked at such a problem, I usually create very simple work sample. Here I would create a new table:
    OBJECT Table 50505 Thomas_Testing
    {
      OBJECT-PROPERTIES
      {
        Date=26-04-06;
        Time=11:56:16;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        OnModify=BEGIN
                   LastModified := WORKDATE;
                 END;
    
      }
      FIELDS
      {
        { 1   ;   ;Key Field           ;Code10         }
        { 2   ;   ;Fill_Something_In_Here;Text30       }
        { 3   ;   ;LastModified        ;Date           }
      }
      KEYS
      {
        {    ;Key Field                                }
      }
      CODE
      {
    
        BEGIN
        END.
      }
    }
    


    Let the "LastModified" be filled in on the tables OnModify-trigger.
    - run the table,
    - add a record (remember to fill-somting-in-here :-)),
    - change the content in "Fill_Something_In_Here",
    - leave the record (to perform an update/run the OnModify-trigger),
    - and go back to it (to update the information shown).

    If you can make this work, then you know how to update "LastModified", and may carry on, where you actually wants the action to happen.
    With Kind Regards
    Thoms Hviid Thorn
Sign In or Register to comment.