cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Compare Strings in Advanced Tag

LS_10366301
2-Guest

Compare Strings in Advanced Tag

I'm trying to use a Derived tag to compare a string tag to some static strings and return boolean response for if it matches or not.  I was hoping the logic operator == would do this like it does for numerical values but expression validation returns "String tag expected".  Is there another logic operator to use to compare string values or do I have to do something different?

 

Using KepServerEX 6.14

 

Thanks!

 

 

ACCEPTED SOLUTION

Accepted Solutions
aservetas
13-Aquamarine
(To:LS_10366301)

It actually does work for String comparison. Please see the example below:

 

aservetas_0-1701439687563.png

 

 

Then writing the same value to String2 evaluates correctly:

 

aservetas_1-1701439780347.png

 

Best regards,

Andy Servetas
Principal Technical Support Engineer | Kepware Technologies

View solution in original post

3 REPLIES 3

Article - "Derived tags not allowing Arithmetic Function with String Tag in a single Expression in PTC Kepware Products": https://www.ptc.com/en/support/article/CS388921

aservetas
13-Aquamarine
(To:LS_10366301)

It actually does work for String comparison. Please see the example below:

 

aservetas_0-1701439687563.png

 

 

Then writing the same value to String2 evaluates correctly:

 

aservetas_1-1701439780347.png

 

Best regards,

Andy Servetas
Principal Technical Support Engineer | Kepware Technologies

Thanks to both of you for the responses!

 

With this information, I was able to confirm that my string comparisons only work when they are the only thing in the derived tag.  Since I had 4 strings to compare, it took me 5 tags instead of one to achieve my goal but it will work for now.  Would be nice to see PTC take this up as an enhancement, where I can do a string evaluation with == in a derived tag and then perform arithmetic functions on the result.

Announcements

Top Tags