Unable to filter by tagType using system.tag.browse()

I am trying to use the system.tag.browse function to generate a list of OPC tags for my system. As a first step I want to filter by tagType and only identify tags that qualify as “AtomicTag”. An unfiltered list generates just fine, but trying to filter with a condition such as:
if results[‘tagType’]==‘AtomicTag’ yields nothing even though the result AtomicTag is clearly showing up in the unfiltered list.

Can anyone please point me in the right direction here? Thanks!

When you print result["tagType"], you’re implicitly converting it to a string. Try print type(result["tagType"]) - it’ll be some more exotic type.

The simplest fix for your issue is to wrap your comparison operation in a call to str():
if str(result["tagType"]) == "AtomicTag":

1 Like

Thank you! This worked! !!