Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

TagsDBPreloadWait

  • Last UpdatedOct 29, 2026
  • 2 minute read

TagsDBPreloadWait is a built-in function that pauses execution of the script in which it is called in order to preload project tags into memory on a project thin client.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

TagsDBPreloadWait

Tags Database

Synchronous

No

Not supported

Not supported

Not supported

Supported

Not supported

Syntax

TagsDBPreloadWait(numTimeOut)

TagsDBPreloadWait ( numTimeOut )

numTimeOut

The amount of time (in milliseconds) that the execution of the script will be paused. At the end of the specified timeout, this function checks whether any loads are still pending.

Returned value

This function should return one of the following possible values:

Value

Description

1

Success (that is, all tags loaded).

0

Failure (that is, function timed out while waiting for tags to be loaded).

-1

This function can be called only on Thin Clients.

If this function returns a negative value that is not shown in the table above, please contact your software distributor for support.

Notes

This function must be called after the TagsDBPreload function. In fact, when this function checks whether any loads are still pending, it only checks tags that were selected for preloading by calling the TagsDBPreload function.

If this function returns a value of 0, which indicates that it timed out, you can use the TagsDBGetPreloadCount and TagsDBGetLoadStatus functions to try to determine why it timed out.

Examples

The following example shows how the TagsDBPreload, TagsDBPreloadWait, TagsDBGetPreloadCount, and TagsDBGetLoadStatus functions can all be used in the Screen_OnOpen sub-routine of the Screen Script:

Sub Screen_OnOpen()

Dim counter, preloadCount, preloadDone, loadStatus

// Select tags for preloading.

preloadCount = $TagsDBPreload("MyTagA")

preloadCount = $TagsDBPreload("MyTagB")

preloadCount = $TagsDBPreload("MyTagC")

preloadCount = $TagsDBPreload("MyArray[1]")

preloadCount = $TagsDBPreload("MyArray[2]")

preloadCount = $TagsDBPreload("MyArray[3]")

// Wait up to five seconds to load tags.

counter = 0

preloadDone = 0

Do

preloadDone = $TagsDBPreloadWait(1000)

preloadCount = $TagsDBPreloadCount()

counter = counter + 1

Loop Until (preloadDone <> 0) Or (counter = 5)

// Save preload count message to string tag, for later use.

$PreloadCountMsg = preloadCount & " tag(s) waiting to be loaded."

// Save load status message to string tag, for later use.

loadStatus = $TagsDBGetLoadStatus("MyTagA")

If (loadStatus = 2) Then

$LoadStatusMsg = "MyTagA is loaded."

ElseIf (loadStatus = 1) Then

$LoadStatusMsg = "MyTagA is waiting to be loaded."

Else

$LoadStatusMsg = "Error while loading MyTagA."

End If

End Sub

In This Topic