TagsDBGetPreloadCount
- Last UpdatedOct 29, 2026
- 2 minute read
TagsDBGetPreloadCount is a built-in function that gets the number of tags that are still waiting to be preloaded.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
TagsDBGetPreloadCount |
Tags Database |
Synchronous |
Yes |
Not supported |
Not supported |
Not supported |
Supported |
Not supported |
Syntax
TagsDBGetPreloadCount()
TagsDBGetPreloadCount ( )
This function has no parameters.
Returned value
If this function is executed successfully, it will return the number (greater than or equal to 0) of tags waiting to be preloaded. Otherwise, it will return one of the following possible values:
|
Value |
Description |
|---|---|
|
-1 |
This function can be called only on Thin Clients. |
Notes
This function is typically called after the TagsDBPreload and TagsDBPreloadWait functions. In fact, when this function gets the number of tags that are still waiting to be preloaded, it only checks tags that were selected for preloading by calling the TagsDBPreload function.
If this function returns a value greater than or equal to 1, which indicates that one or more tags are still waiting to preloaded, you can use the TagsDBGetLoadStatus function to try to determine which tags those are.
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