Selecting tags dynamically / programmatically?

Daveyh

Member
Join Date
Jun 2015
Location
San Francisco
Posts
15
I'm not sure the best way to ask this as there are probably dozens of ways to do this. Seems like it should be simple and something that's done all the time.

I'm using FactoryTalk View SE and I want to display data from an OPC server on a StringDisplay1. Easy, put the tag in the Expression box:

{Network.51.192.101.1815.RA.2310.Channel1.Value}

The hard part is that I want to be able to change which tag that StringDisplay1 gets its data from. There's another selector switch control that sets the active channel (1, 2, 3,..). Whatever active channel is selected is what data StringDisplay1 should display. Ideally there'd be a variable "ActiveChannel" and you could just put that in the tag name something like:
{Network.51.192.101.1815.RA.2310.Channel<ActiveChannel>.Value}
or maybe "{Network.51.192.101.1815.RA.2310.Channel" + ActiveChannel + ".Value}"

Or something like that. Haven't found a clue about if that's possible or what the syntax would be.

The other way I thought would be to use VBA to read the data from the OPC server and write it to a user tag or to the StringDisplay1 but I haven't been able to figure out how to read OPC data in VBA.

Thanks!
 
Last edited:
Not a SE user but wouldn't a Multi-State Indicator do the same thing. Hard code the 3 channels and use the switch selection tag to display.
 
You want to look into "Parameter Files". Essentially, you want to put a place holder into your network address. The place holder can be dynamically updated by passing a parameter file into it. The parameter file holds any number of defined parameters that uniquely identify the value you want to grab.

I'm away from the RSView game so I don't have any good references off the top of my head, but search the forums and manuals for Parameter Files, parameter passing. Should get you to what you want.

Should look something like:
{Network.51.192.101.1815.RA.2310.Channel#1.Value} where #1 is the placeholder. And when you click on the button a macro or configured parameter file would be read, and substitute the #1 value.

The parameter file would be something like:
#1 = 1
#2 = 45

Each parameter file is unique, but you can dynamically select which parameter file to pass.
 
Last edited:
My example was simplified for clarity. The channels can be from 1 to 9999 and there are about 10 controls per channel. the operator will enter the channel number, then all the controls on the HMI will display the relevant data for that channel.

Thanks

QUOTE=cwal61;659634]Not a SE user but wouldn't a Multi-State Indicator do the same thing. Hard code the 3 channels and use the switch selection tag to display.[/QUOTE]
 
I did stumble upon parameter files in my googling and it sounds close, but very cumbersome. It sounds like I'd need a different file for each channel setup in advance, which could be in the hundreds if not thousands. The range is 1 to 9999 but not all would be used, but I wouldn't know in advance which ones were used.

File1:
#1 = 1

File2:
#1 = 2
.....
File9999:
#1 = 9999

When all i really want to do is an instruction:
Set #1 = 1243

Surely there's a better way?? :-(


You want to look into "Parameter Files". Essentially, you want to put a place holder into your network address. The place holder can be dynamically updated by passing a parameter file into it. The parameter file holds any number of defined parameters that uniquely identify the value you want to grab.

I'm away from the RSView game so I don't have any good references off the top of my head, but search the forums and manuals for Parameter Files, parameter passing. Should get you to what you want.

Should look something like:
{Network.51.192.101.1815.RA.2310.Channel#1.Value} where #1 is the placeholder. And when you click on the button a macro or configured parameter file would be read, and substitute the #1 value.

The parameter file would be something like:
#1 = 1
#2 = 45

Each parameter file is unique, but you can dynamically select which parameter file to pass.
 
Instead of using a string display. Use a text box display. You can insert a variable in a text box.
 
I did stumble upon parameter files in my googling and it sounds close, but very cumbersome. It sounds like I'd need a different file for each channel setup in advance, which could be in the hundreds if not thousands. The range is 1 to 9999 but not all would be used, but I wouldn't know in advance which ones were used.

File1:
#1 = 1

File2:
#1 = 2
.....
File9999:
#1 = 9999

When all i really want to do is an instruction:
Set #1 = 1243

Surely there's a better way?? :-(

That is the most direct way.
You could go ahead and dynamically code your application in VBA, that would work, but becomes more complex.
 


I did look at that, and looked again. Maybe I'm missing the big picture or something? I still somehow have to be able to select which of the 10,000 tags get assigned to the variable. I essentially need to be able to insert a variable into the tag name itself, yet I don't see any mention of that in Ch. 21 :-(

Thanks
 

Similar Topics

I am working on trying to create a an HMI program where the user can select a value from 1-25 and then enter a string, which will be placed into...
Replies
5
Views
1,054
We had a servo motor feedback cable get damaged recently and we want to order a replacement. The current cable is a custom made cable, and we...
Replies
1
Views
885
Not sure how to word the title but here's my scenario. We have a carriage that moves at high speed with an energy chain and the cable bends in a...
Replies
11
Views
2,861
Hello plctalk, new guy here. I have an application that I'd like to present for your considered opinions so I can figure out what hardware I...
Replies
11
Views
2,504
Hi, I frequently demonstrate automation product (that we make) to various customers. The system uses an AB7007 Anybus gateway that connects to...
Replies
16
Views
5,255
Back
Top Bottom