SLEEP Function

navuser1navuser1 Member Posts: 1,329
Hi All,

I'm working in Nav 4.0 Sp3.
And I want to see the (best) use of SLEEP function
in my base DB(Cronus).


Thnx & regards.
Now or Never

Comments

  • garakgarak Member Posts: 3,263
    From Online Help.
    SLEEP
    Use this function to return control to the operating system for a specifiable amount of time.

    SLEEP(Duration)
    Duration

    Data type: integer

    The number of milliseconds to return control to the operating system for.

    Comments
    When using SLEEP, control is guaranteed to return to the operating system for at least Duration milliseconds (implying that the period may be longer, depending on what the operating system is doing at the time when control is to return to the caller.)

    For example: You execute a batch during the NAS. And in this batch you block the, for example, Customer Table.
    So with sleep, for example every 100 Recs, you give other processed the chance to handle the customer (blocked) table.

    Regards
    Do you make it right, it works too!
  • navuser1navuser1 Member Posts: 1,329
    Thnx garak.

    anything more ??
    Now or Never
  • kinekine Member Posts: 12,562
    No, I use only the sleep as garak described. To let others to do something.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kapamaroukapamarou Member Posts: 1,152
    I use it in the following scenarios:

    A) The user uploads a file that on-the-fly creates sales orders and posts them. Since posting will block tables Value Entry, G/L Entry, Item Ledger Entry etc I use the SLEEP function in order to allow the rest of the users to post their orders without being locked for the time needed to post some thousands of orders coming from the file...

    B) I generate six different reports printed through a generic text printer to a file all at the same time. I use this function to give the OS some time to rename the first produced file before trying to overwrite it...
Sign In or Register to comment.