Timer in RoleTailored Client

YuriMYuriM Member Posts: 12
edited 2009-01-29 in NAV Three Tier
Hi,

is there still any possibility to use a Timer (built-in or as an automation object) in the RoleTailored Client?

We have one solution (NAV 5.0 SP1) that uses Timer (Automation object) for regular checking whether there are any new data in a table. We want to port this solution to NAV 2009. In the Classic Client (SQL) everything works fine, but in the RoleTailored Client we don't get any events from Timer.

Any ideas how to work it around?

Comments

  • greensmilegreensmile Member Posts: 7
    YuriM wrote:
    Hi,
    Any ideas how to work it around?
    IMHO try hook on OnGlobalInsert in CU 1instead of timer. Of course you have to insert record with trigger => rec.INSERT(TRUE).
    _-========-_
    GreenSmile
  • YuriMYuriM Member Posts: 12
    Thanks, but OnGlobalInsert works only for the current instance of the Client. It doesn't tell if another user has added a record into the table. And anyway it doesn't work with INSERT(TRUE) - it works only when a user presses F3 and creates a new record.
  • DenSterDenSter Member Posts: 8,307
    I think they removed event handling from automation. The timer object itself would exist, and it would run, but NAV would not be able to catch the events.
  • kinekine Member Posts: 12,562
    You can use classic NAS for that..
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • dmc-dkdmc-dk Member Posts: 42
    I've just created a codeunit with NavTimer (WithEvents) like this:
    OnRun()
    CommentLine.SETRANGE("Table Name",CommentLine."Table Name"::Customer);
    CommentLine.SETRANGE("No.",'10000');
    CommentLine.DELETEALL;
    
    CREATE(NavTimer);
    NavTimer.Interval := 5000;
    NavTimer.Enabled := TRUE;
    
    NavTimer::Timer(Milliseconds : Integer)
    LineNo := LineNo + 10000;
    CommentLine.INIT;
    CommentLine."Table Name" := CommentLine."Table Name"::Customer;
    CommentLine."No." := '10000';
    CommentLine."Line No." := LineNo;
    CommentLine.Date := TODAY;
    CommentLine.Comment := FORMAT(LineNo);
    CommentLine.INSERT;
    
    NavTimer::TimerError(ErrorString : Text[1024])[/b]
    

    Set SingleInstance to Yes and added a call to this codeunit to an action on a page.
    Now when I click on that action in RTC - I get the CommentLine table filled in with comments just fine. :)

    Conclusion - events do work on RTC, just make sure you don't write any code that interacts with user from the event triggers (e.g. MESSAGE('I am working!!') or FORM.RUN(5052)) - this will shut down the events.
  • kinekine Member Posts: 12,562
    But I assume that it will not "run" forever (depends on settings). After time entered in ClientReconnectPeriod if the RTC will not communicate with the NST, the "connection" can be disposed and the instance will be closed. But it is just my assuming.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.