IOSetAccessName() Function
- Last UpdatedJun 02, 2021
- 2 minute read
You can implement Dynamic Reference Addressing by using the IOSetAccessName() function within a script. IOSetAccessName() modifies the application or topic name characteristics of an I/O tag’s Access Name during run time.
Note: When the IOSetAccessName() function is processed, there is a time delay while the existing conversation is terminated and the new conversation is started. During this period, any attempted POKEs or writes to the new topic are lost.
Category
Miscellaneous
Syntax
IOSetAccessName("AccessName", "NodeName", "AppName", "TopicName");
Arguments
AccessName
The existing Access Name to assign the new AppName and Topic Name values to. Actual string or message tag.
NodeName
The new Node Name to assign. Actual string or message tag.
AppName
The new Application Name to assign. Actual string or message tag.
TopicName
The new Topic Name to assign. Actual string or message tag.
Remarks
The values assigned to the AccessName, AppName, and TopicName arguments can be specified as literal strings or string values provided by other InTouch tags or functions.
If you configured a secondary source for access name failover using the Add Access Name dialog box, you cannot change the secondary source configuration at run time using the IOSetAccessName() function.
Note: When creating Access Names in WindowMaker, if the Access Name is SuiteLink type, the InTouch HMI prevents Access Names from accessing the same, node, application, and topic. Do not allow the IOSetAccessName() function to redirect Access Names to duplicates during run time. Using the IOSetAccessName() function in run time allows SuiteLink type Access Names to be redirected to duplicate topics. The redirected Access Name will not work.
Examples
The MyAccess1 Access Name can be changed to point to the Excel application and the [Book1]Sheet1 topic, without affecting the current NodeName, by using the following script function:
IOSetAccessName("MyAccess1", "", "EXCEL", "[Book1]Sheet1");
If an empty string is specified for a Topic, the Access Name’s current Application value is updated and its Topic value is retained.
For example, the following script changes the Application Name for the MyAccess2 Access Name to EXCEL without affecting its current Topic value:
IOSetAccessName("MyAccess2", "", "EXCEL", "");
If an empty string is specified only for an Application Name, the tag’s current Topic value is updated and its Application value is retained. For example, the following script changes the Topic for the MyAccess3 tag to [Book2]Sheet1 without affecting its current Application Name value:
IOSetAccessName("MyAccess3", "", "", "[Book2]Sheet1");
This example can be used when PLC redundancy is a requirement.