Aiasa21
December 30, 2022, 1:35pm
1
Hi guys,
I'm trying to use the filterTag extension in a Tag Browse Tree in Vision but I can't make it works as I would.
Here is the full root of the folder:
I add this code to the filterTag extension and it works good
def filterTag(self, tag):
test = ['Allarmi', 'Archivio']
if tag.name in test:
return False
else:
return True
I have this as result, as you can see the Allarmi and Archivio folders are not in the list.
What I would like to do is instead of remove the folders, I want to have a dataset with only the folder to show, so I simply edit the code in this way
def filterTag(self, tag):
test = ['Allarmi', 'Archivio']
if tag.name in test:
return True
else:
return False
in this case I was expecting that only the folders in the dataset are shown, but instead I have no more folders in the tree
What do I wrong?
I must be missing something. The root folder in your first example is totally different from your final example. Are they the same tag browse tree instance?
Aiasa21
December 30, 2022, 2:07pm
3
That's exactly the point. The tag browse tree is the same, I just edit the filterTag extension script.
If I filter in this way
def filterTag(self, tag):
test = ['Allarmi', 'Archivio']
if tag.name in test:
return True
else:
return False
returning True in the case if I have a match of tag.name with the dataset, the root folder seems disappear and I have only ROOT -> default.
If I reverse the script returning False at first, the root folder back as the first example except the 2 values in the dataset that are filter.
Wow; that's totally unexpected. What version are you running?
Aiasa21
December 30, 2022, 2:19pm
5
8.1.23 .. Yeah looks strange.. I mean I can just filter the folders I want to remove, but should be faster to do vice versa.
I tested this on version 8.1.20, and I was not able to replicate this result. My tag browse tree works as expected:
First:
def filterTag(self, tag):
test = ['Ramp', 'Sine']
if tag.name in test:
return False
else:
return True
Result:
Second:
def filterTag(self, tag):
test = ['Ramp', 'Sine']
if tag.name in test:
return True
else:
return False
Result:
I tried to upgrade to 8.1.23 to see if I could replicate the error there, but I'm running into this:
I'll try again later when I have more time if nobody else comes up with anything first
Thanks for your help, so looks like it is a bug of my version, do you know how can I do to warn somebody of the Ignition team in this case?
I finally made the time to update my system 8.1.23, but I was still unable to replicate the problem.
The tag browse tree worked as expected on my system. Perhaps it's time to get support involved.
Hi Justin, sorry for my late answer. I'll try to contact the support at this point, thanks for your time.
1 Like