Parameter Informative messages in Python Toolboxes

127
1
2 weeks ago
steveb23
New Contributor

Hi all,

Using an ArcGIS Pro 3.1 python toolbox, I am trying to get a parameter information message changed dynamically in the code using the updateMessages function.

I can set an error message, or warning successfully, but I can't seem to find a way to set just an information message. I don't think the ID message supports non errors or warnings either?

The use case is a user chooses a spreadsheet to import using a parameter. Upon the spreadsheet file being chosen the code opens the spreadsheet and confirms the month of data being imported. I would like to put an information message on the parameter saying "Spreadsheet X Validated. May 2024 data will be imported".

Is this possible? - I can't seem to find anything that suggests it is.

Tags (2)
0 Kudos
1 Reply
AlfredBaldenweck
MVP Regular Contributor

I don't think there is a way to change normal messaging outside of using the tool's metadata.

I think there may be an idea to add metadata inside the toolbox, but I don't remember where it is.

However. It sounds like you have an excel file and then it checks for a sheet inside that's named like "January" or something. Why not just make that parameter a Table parameter? There isn't a default filter for it, but you can use updateMessages() to validate like

if '.xlsx' not in parameters[0].valueAsText: 

    parameters[0].setErrorMessage("Must be an Excel sheet.")

This way the user knows exactly which sheet they're using, and you don't have to guess about it.

0 Kudos