InTouch runtime discovery of tag types

sryan

Member
Join Date
Sep 2005
Location
NJ
Posts
7
Hi all,

Is it possible in InTouch V8.0 (or any version for that matter) to discover the type of a tag at runtime, or whether that tag exists in the database?

For example, I'd like a general function to write a value to a tag, without having to know a priori what type that tag is. Something like the following:

CALL WriteTag(TAG_REAL.Name, "123");
CALL WriteTag(TAG_MSG.Name, "hello, world!");

WriteTag would accept two MESSAGE args, msgTagname and msgValue. The code would look something like this:

IF TagExists(msgTagname) THEN
IF IsMessage(msgTagname) THEN
TAG_INDIRECT_MSG.Name = msgTagname;
TAG_INDIRECT_MSG = msgValue;
ELSE IF IsReal(msgTagname) OR IsInteger(msgTagname) THEN
TAG_INDIRECT_ANA.Name = msgTagname;
TAG_INDIRECT_ANA = StringToReal(msgValue);
ELSE IF IsDiscrete(msgTagname) THEN
TAG_INDIRECT_DSC.Name = msgTagname;
TAG_INDIRECT_DSC = StringToIntg(msgValue);
ENDIF; ENDIF; ENDIF;
ENDIF;

Do these magical functions TagExists, IsMessage, IsReal, etc. exist? Can I cobble them together somehow? I'm willing to write an external DLL if needed.

Thanks in advance!

Steve
 
The function TagExists(Tagname) will give you the info that you need:
If the tag does not exist a negative value will be returned. If the tag does exist, the the value 1 will be returned for a discrete tag, the value 2 will be returned for an integer tag, the value 3 will be returned for a real tag, and the value 4 will be returned for a message tag.

You can also use the function ITTagType(Tagname). Look for it in the ww knowledgebase.
 
Thanks, Dave! That's exactly what I need.

Y'know, I went back to Wonderware's website and searched for TagExists and ITTagType, drew a blank on both. I didn't even think to look through the knowledge base CD, I assumed all that would be available on the website.

Anyway, thanks for the quick response- it really helped me out.

Steve
 

Similar Topics

Wizard of Intouch, I summon you. I'm having problem when publishing the runtime application from my workstation to the runtime panel. My...
Replies
0
Views
740
Could anyone please provide script to show popup on active screen ..? I have written windows script to show on current screen in " While showing...
Replies
0
Views
859
Hello all, I have programmed a script in InTouch which will increment a value (lets say "tag1") from 0 to 10000 within a given interval. This...
Replies
18
Views
5,876
I used a few built-in SA symbols, and by default, their color is grey... so I loaded a new element style to make them look better. However, no...
Replies
0
Views
1,490
I'm upgrading a panel mounted PC in the field. I'm going to install InTouch runtime and just copy and paste the LIC files from the old PC.. Is...
Replies
11
Views
4,523
Back
Top Bottom