LiesInYourEyes
Member
(Solved)
Howdy everyone,
Quite a newbie here. Come from a programming background and fell into working with PLC (Logix 5000) and Wonderware Intouch at work due to my ability with logic and history as a programmer.
I am trying to find a way to simplify some of the work were doing by creating a quick function that will call specific data from our PLC that is stored in various ways instead of creating a bunch of tags.
So I can understand how to call program tags and data fairly well. But I am not sure if what I am trying to do is possible. We have some items on the screen and when you click on them it opens up a window with multiple data fields that are called from an array. I was hoping to just create local variables for each of the item that represent their position in the array and then use the StringFromIntgr() function to convert them to a string, then combine the strings into the item address I want to call from the PLC, and then assign this to tag that would be displayed on the popup window.
So i.e, an On Show Condition Window Script:
DIM ProgramName AS Message;
DIM ArrayPosition1 AS Integer;
DIM ArrayPosition2 AS Integer;
DIM ArrayPosition1String AS Message;
DIM ArrayPosition2String AS Message;
DIM ItemAddress AS Message;
ProgramName = "SomeProgram"
ArrayPosition1 = 1;
ArrayPosition2 = 1;
ArrayPosition1String = StringFromIntgr(ArrayPosition1, 10);
ArrayPosition2String = StringFromIntgr(ArrayPosition2, 10);
ItemAddress = "Program:" + ProgramName + ".Array1Name[" + ArrayPosition1String + "].Array2Name[" + ArrayPosition2String + "].InformationIWant"
{This should produce "Program:SomeProgram.Array1Name[1].Array2Name[1].InformationIWant"}
{So the InformationIWant is an Integer}
{I've created a tag that is an I/O Integer name tempIntegerValue that points to a 0 value, and indirect analog named DisplayValue}
tempIntegerValue.Name = ItemAddress;
DisplayValue = tempIntegerValue.Name;
However DisplayValue will either display !!(error) or a 0.
Is there a way to go about this that would be successful?
Thanks!
G
Howdy everyone,
Quite a newbie here. Come from a programming background and fell into working with PLC (Logix 5000) and Wonderware Intouch at work due to my ability with logic and history as a programmer.
I am trying to find a way to simplify some of the work were doing by creating a quick function that will call specific data from our PLC that is stored in various ways instead of creating a bunch of tags.
So I can understand how to call program tags and data fairly well. But I am not sure if what I am trying to do is possible. We have some items on the screen and when you click on them it opens up a window with multiple data fields that are called from an array. I was hoping to just create local variables for each of the item that represent their position in the array and then use the StringFromIntgr() function to convert them to a string, then combine the strings into the item address I want to call from the PLC, and then assign this to tag that would be displayed on the popup window.
So i.e, an On Show Condition Window Script:
DIM ProgramName AS Message;
DIM ArrayPosition1 AS Integer;
DIM ArrayPosition2 AS Integer;
DIM ArrayPosition1String AS Message;
DIM ArrayPosition2String AS Message;
DIM ItemAddress AS Message;
ProgramName = "SomeProgram"
ArrayPosition1 = 1;
ArrayPosition2 = 1;
ArrayPosition1String = StringFromIntgr(ArrayPosition1, 10);
ArrayPosition2String = StringFromIntgr(ArrayPosition2, 10);
ItemAddress = "Program:" + ProgramName + ".Array1Name[" + ArrayPosition1String + "].Array2Name[" + ArrayPosition2String + "].InformationIWant"
{This should produce "Program:SomeProgram.Array1Name[1].Array2Name[1].InformationIWant"}
{So the InformationIWant is an Integer}
{I've created a tag that is an I/O Integer name tempIntegerValue that points to a 0 value, and indirect analog named DisplayValue}
tempIntegerValue.Name = ItemAddress;
DisplayValue = tempIntegerValue.Name;
However DisplayValue will either display !!(error) or a 0.
Is there a way to go about this that would be successful?
Thanks!
G
Last edited: