# TKDataAccess is located with the product installation files
# 
# If you move this code to another computer, replace the 127.0.0.1 to server you want to connect
# This code can only run on computers where the product is installed
#
# The Macros _ToolkitPath_ and _ExecutionPort_ are resolved automatically before we call this Python code
# If you call the py file directly you need to replace those macros
#
# _ToolkitPath_ should be replaced by the product binaries folder (location of T.Toolkit.DLL and other DLLs)
# _ExecutionPort_ should be replaced by the port number TServer is running, ex.: 3101 (which is dependent on the ExecutionProfile)

import sys
installPath = "_ToolkitPath_"
sysPath = ";".join(sys.path)
if sysPath.find(installPath) < 0 :
    sys.path.append(installPath)
print(installPath)


from TKDataAccess import TKDataAccess

dataAccess = TKDataAccess()
connectionStatus = dataAccess.Connect("127.0.0.1:_ExecutionPort_", "guest", "")

if dataAccess.IsConnected() :

	value1 = dataAccess.GetObjectValue("Tag.Tag1[3]")
	value2 = dataAccess.GetObjectValue("Tag.Tag2[3]")
	ret = value1 + value2
	dataAccess.SetObjectValue("Tag.Result[3]", ret)
	print(str(ret))
	dataAccess.Disconnect()
