English (United States)
Call us! 512-349-0334 or (877) INDUSOFT

InduSoft Web Studio Forums

Find additional forum posts in in the Forum Archives. For assistance view the Forum Frequently Asked Questions.

Reading tags with index
Last Post 14 Dec 2018 10:12 AM by Stavros_d. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
stefanbrouwerUser is Offline
New Member
New Member
Posts:2


--
06 Dec 2018 08:21 AM
    I wanted to use a variable index for reading a tag from the device so i could for example select a port and then it would show me the value of that port.

    In my PLC program I have the following array:
    aExample : ARRAY[0..3] OF INT;

    In my HMI i have a variable "iSelectedPort" which is an integer,
    I want to give the text from a textbox the following tag/expression:
    aExample[iSelectedPort]

    The problem is that I can only choose DEV.MAIN.aExample[0], DEV.MAIN.aExample[1], etc., which are automaticly changed to DEV.MAIN.aExample_0_ and DEV.MAIN.aExample_1_ and so on.

    Changing it to DEV.MAIN.aExample_iSelectedPort_ or DEV.MAIN.aExample[iSelectedPort] doesn't work.

    Is there any way to do it the way I want to?

    (Currently i do have some kind of work-around, bit it's a lot more work i have to do.)


    (I am working with twincat 3 and indusoft 7.1)
    stefanbrouwerUser is Offline
    New Member
    New Member
    Posts:2


    --
    07 Dec 2018 01:17 AM
    Apparantly the problem was that i wanted to access a variable that was within a structure...
    One way to use arrays with a variable index is defining them straight into the FB, but that would be way to messy.

    If it is possible to do this with variables that are in a structure, then please let me know.
    Stavros_dUser is Offline
    New Member
    New Member
    Posts:6


    --
    14 Dec 2018 10:12 AM

    You can do it by creating an array tag or an array of classes on IWS and map the members on a driver sheet, but not by using tag integration. Tag Integration unfortunately converts all structure instances to unique instances.
    Another way to do this is indirect tags feauture(see help).
    You are not authorized to post a reply.