TagsDBSync
- Last UpdatedOct 29, 2026
- 2 minute read
TagsDBSync is a built-in function that forces the project thin client to get the latest value of a project tag from the project runtime server.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
TagsDBSync |
Tags Database |
Synchronous |
No |
Not supported |
Not supported |
Not supported |
Supported |
Not supported |
Syntax
TagsDBSync(strTagName)
TagsDBSync ( strTagName )
strTagName
The name of the project tag to be synchronized. If it is an array and/or class, and if you specify an array position and/or class member, only that position and/or member will be synchronized. Otherwise, all positions and/or members will be synchronized.
Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.
Returned value
This function will return one of the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Success (that is, tag value synchronized with project runtime server). |
|
-1 |
This function can be called only on Thin Clients. |
|
-2 |
Invalid tag name; the specified project tag does not exist in the tags database. |
|
-3 |
Local tag specified. Only tags with Server scope can be specified for this function. |
Notes
If a project thin client is subscribed to a project tag in the tags database on the project runtime server, the server will send updates to the client whenever the tag value changes. In most cases these updates are effectively instantaneous, but sometimes there might be a delay due to poor runtime performance on the server, the client, or the network itself, and this delay can cause issues in the execution of scripts on the client.
This function forces the project thin client to synchronize a tag value — that is, get the latest value of the tag from the project runtime server — before it tries to use that tag value. This is especially useful when the client executes one script that sets the tag value and then another script that uses the tag value. For example, given the following scripts…
Graphics_OnStart sub-routine of the Graphics Script:
$MyTag = 90 $Open("Screen1")
Screen_OnOpen sub-routine of the Screen Script for Screen1:
myVar = $MyTag
…you would expect myVar to have a value of 90, after Screen1 is opened. However, setting the value of MyTag in the first script merely submits that change to the project runtime server. The server still needs to save the change in the tags database and then send the updated tag value back to the client. If there is a delay, as described above, then the second script might be executed using the old value of MyTag. This issue can be resolved by modifying the second script…
OnOpen script for Screen1:
$TagsDBSync("MyTag") myVar = $MyTag
Again, in most cases, tag value updates are effectively instantaneous, so you should use this function only when it is necessary to resolve issues. Calling and executing unnecessary functions can affect runtime performance.
Examples
Synchronize the project tag named MyTag:
TagsDBSync("MyTag")
Synchronize the entire array named MyArray:
TagsDBSync("MyArray")
Synchronize a single position of MyArray:
TagsDBSync("MyArray[123]")