Monitor Pro (Factorylink) Random tag access


Thread Starter



Here's a little problem related to some demonstration work I need to do.

I've got lots of tags, named like PUMP_G5_STATUS and VALVE_D7_STATUS.

I want to use IML to modify the values of a random selection of these tags.

(They are not arrays, that would be too easy!)

What I need is a way of 'building' the required tagname, probably by joining text strings, then using the string as a tagname.

Building the string is easy, but how do I then use that string as a Tagname?


Gustavo A. Valero P.

Hi again (3rd time), :)

There is no way to do it by using IML, unfortunately. Maybe by using CML and FL's API (PAK) this could be done, but will be too expensive for a demo.

I think that by using VBA you could create what you want to (I will have to test it to be 100% sure).

Good luck!

Best regards.


Gustavo A. Valero P.
BIConsulting C.A.
Valencia - Venezuela
[email protected]
Hi Gustavo,

Thanks for your reply.

It is unfortunate that FL does not support indirect addressing of tags. Most other SCADAs I've used have some method of doing this.

I think I will write a few procedures, each modifying a different bunch of tags, then call the procs at random.

With enough procedures called at random it should look like what I want.

Thanks again for your help.

Gustavo A. Valero P.


FactoryLink still supports indirect addressing of tags but not using IML or VBA!

If you use CML, the 'FL_Tagname_To_ID' function is what you need. If you know how to use CML well (it's not free unfortunately) you won't have any problem to do it.

In FL ECS 6.x this was possible by using PowerVB (a kind of VBA). Here, the 'RTDBObjectValue' function carried out this job perfectly but with the new graphics editor (Client Builder) used by FL 7.x, nobody misses it (well, I think you are the 1st one that I know) :)

You can still use the old graphics editor (called 'Application Editor') and see/create your own displays and PowerVB codes but I recognize that it isn't your goal and wish.

I will try to write to UGS/Tecnomatix to know where they "put" the 'RTDBObjectValue' function inside VBA libraries.

If I were you, I will do an only one procedure and use arrays tags instead, I mean:


where 'x' or 'y' are the random numbers generated by you. It's just a suggestion!

Best regards.


Gustavo A. Valero P.
BIConsulting C.A.
Valencia - Venezuela
[email protected]
Hi Gustavo,

I'm not too good at CML, but anyway a CML solution would not be acceptable.

The client's existing FL 6.6 is packed full of CML, and array varables. Debugging and modifying is a nightmare. Array variables like PUMP[678] or VALVE[1344] are processed by hundreds of CML procedures.

My task is to show how branched variables will make his system easier to maintain.

I have however thought of another method of changing random tag values.

Switch on the DDESERVER task, and send tag values from an external programme, maybe VB or even Excel.

Although this is 'old' technology, it looks perfectly adequate for what I need to do, and it requires no IML, CML, VBA, or any other stuff indide the FL app itself. (I could use OPC, but DDE is, I find, much easier for a simple quick solution.)

I will try this just as soon as I get a system to try it on. (My 10 days is up!).

Thanks again for all your help. Having like minded engineers on to bounce ideas around with makes this site feel like a real community.

Tony R. Gunderman

<p>If you are working in VBA in the ClientBuilder application, I think you can define an object of variable type and then set it to various variable names as you wish. This will not be an "integral" application like IML/CML, but it may serve your purpose as well as setting up separate VB or Excel app. Quick example that is probably buggy but might give you the general idea:
Dim varMyPumpTag As Variable
Dim sPumpTagName as String
Dim sUnit as String

sUnit = "G5"
sTagName = "DefaulOPC:mad:PUMP_" & sUnit & "_STATUS"

' Add the variable subscription unless already
' subscribed.
Variables.Add sTagName

' Set variable object to subscribed variable.
set varMyTag = Variables(sTagName)

' Wait for subscription to complete.
' May want to add a timeout.
While (varMyTag.Status = fvVariableStatusWaiting)
Sleep 10

' Read Value or whatever.
msgbox "Value of " & sTagName & " = " & varMyTag.Value

' Cleanup.
set varMyTag = Nothing
Variables.Remove sTagName

Gustavo A. Valero P.

Hola Buzby,

If you are using FL 6.6 so, you can use with no problem the 'RTDBObjectValue' function using PowerVB (like VBA in FL 7.x, your PowerVB codes need that the FL 6.x displays are opened).

I give you an example:

Dim MyTagValue as RTDBObject
Dim MyTagName as String

Set MyTagValue =RTDBObjectValue(MyTagName)

Msgbox "The current value is :" & Str$(MyTagValue.Value)

It's much easier than use DDE or an external program (if I understood your idea well!). In FL 7.x the 'branching' concept is used and works very well to be used at server or client side but this isn't your scenario.

Keep in mind that if you are going to read/write data from/to a FactoryLink server (in realtime) using a 3rd party program, you will have to buy an additional CAL for this if you don't have one available (write/read data using FL DDE Client doesn't consume I/O tags so, it's free).

Best regards & thanks for your comments!


Gustavo A. Valero P.
BIConsulting C.A.
Valencia - Venezuela
[email protected]
Hola Gustavo & Tony,

Thanks to both of you for your ideas. It's good to know what options are available.

Review -

Client's existing app is 6.6 with *lots* of CML and tag arrays.

Client wants new 7.x app with no CML and no tag arrays.

Much of the CML and array stuff is being used to do stuff that branches can do easier. I want to prove this with a demo app with lots of branched variables.

(I want to just demo the server side, no graphics.)

Client is unsure if some functions will work fast enough without CML.

The demo will choose tags at random, then set them to some value.

Because I not demoing a client I can't use VBA.

Because he wants no arrays or CML I can't use the C functions.

Result -

I have done the DDE option! It works for the demo stuff I need to do. The final project, if it happens, will not need the 'indirect' tag access, I only need it to change lots of tag values for the demo.

Thanks again for all your help.


Gustavo A. Valero P.

Excellent point Tony!

Your post is the solution for this mistery. :)

The 'Variables' collection is what anyone needs to create an indirect addressing of tags in FL 7.x (VB) and it is the equivalent of legacy 'RTDBObjectValue' function in FL 6.x (PowerVB).

There are 2 ways to write this:

1) Variables(sTagName) or
2) Variables.Item(sTagName)

Today I learned someting new helping others!


Feliz fin de semana.

BIConsulting C.A.
Valencia - Venezuela
[email protected]