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
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