Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using TKDataAccess.Py

In this example, we will you need to call a file named Main.py, which contains code that copies the content from tag1 (source) to tag2 (target).

...

Code Block
import sys
from Extensions.TKDataAccess import TKDataAccess dataAccess = TKDataAccess()
connectionStatus = dataAccess.Connect("127.0.0.1:3101", "guest", "") print("Connection: " + connectionStatus)

if dataAccess.IsConnected() :
ret  =  dataAccess.GetObjectValue("Tag.tag1") print("Value: " + str(ret)) dataAccess.SetObjectValue("Tag.tag2",  ret)

dataAccess.Disconnect()


Then, in your project, you need to create a code or a Python Script Task that executes the Main.py file, which contains the calling for TKDataAccess shown above. So here, we will use the Python namespace as previously described.

...