Select to view content in your preferred language

Python script tool Validation Filter.List just shows empty strings

659
5
01-10-2024 06:54 AM
rhughes522
New Contributor III

In ArcPro 2.9.5 I have a python script tool in the new toolbox (.atbx) with validation that sets the filter.list.  

The issue I am seeing is that the values in the list are all empty strings.  The number of rows is correct but the values are all empty.  

I've simplified my python code to just set ['test1', 'test'2'] as the filter.list and it shows up like the screenshot below.  What could I possibly do differently here to make this work?  I am going to try the old style toolbox.

rhughes522_2-1704898401295.png

 

rhughes522_0-1704898290044.png

 

0 Kudos
5 Replies
rhughes522
New Contributor III

Well i copied the script tool into the legacy (.tbx) toolbox and it worked as expected.  It seems like this is probably a bug in the new (.atbx) toolbox.  I hope this might help.

Thanks!

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

Keep it simple.

Basically, what I think is happening is you're applying the list to a copy of the parameter filter, not the actual filter? (Or maybe not, but that's how it makes sense to me in my head lol) Either way, this works.

def initializeParameters(self):
        filterlist = ["test1", "test2"]
        self.params[0].filter.list = filterlist
        return

 

AlfredBaldenweck_3-1704899307491.png

 

AlfredBaldenweck_0-1704899182588.png

AlfredBaldenweck_2-1704899297570.png

 

 

 

0 Kudos
rhughes522
New Contributor III

Well my script tool is not really that simple which could be partly to blame for the apparent bug.  When I copied it into the legacy toolbox is just worked.  I did previously try setting the filter.list using the same syntax on a single line previously and it didn't work.  My best guess is that something in the script tool itself was causing an issue.  Maybe something with the other parameters.  Since I've already deleted the .atbx file I cannot copy the script tool from a legacy into a new .atbx to test again.  It would take me too much time to rebuild so I am just going to finish it in the legacy toolbox, then if I have time I will take another look.  Thanks for the feedback.  When I get some time to rebuild in the .atbx I will give it another try.

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

You can copy a script tool from a tbx to an atbx by right-clicking; all you need is an atbx to paste it into.

Definitely when you have time to try again, share more of your parameters/validation and we can figure out what the problem is.

0 Kudos
rhughes522
New Contributor III

I am getting an error when I try to paste the script tool into a new .atbx toolbox from a legacy but it worked the other direction for me.  I've tried creating an .atbx in a different folder too.  I just assumed they were not compatible, but this could just be an issue with the Citrix environment or the File System.  It's been a headache working in this environment for sure.

rhughes522_0-1704900504489.png

 

0 Kudos