I'm running into an issue with my model that I am hoping someone can help me out with! Essentially I am using this model to update Flood Zones when LOMC's are filed with FEMA. My issue here is that there will be times where there will be multiple flood sources or the parcel crosses multiple FIRM Panels. I am looking for a way for those field to be pick lists and allow for a multi-value input and have it combine into a single string. Below is an example of what I mean
Parcel A has a flood source of River X, Y Ditch, and Sheet Flooding. I want to have a pick list showing:
The user selects the necessary Flood Sources and then when the model runs it puts it into the field as:
River X; Y Ditch; Shallow Flooding
Does anyone have any suggestions? I have attached a screenshot of the model if it helps.
Thanks!
Greg
Solved! Go to Solution.
Maybe I am reading too much into this. You can create hard coded pick lists of strings with parameter validation in the model properties for parameters River, Ditch, Flood type
Then you can use the Calculate Value tool with Python expressions like these, and then use the Calculate Value output model element in a Calculate Field string down the chain. (Tip: Use Precondition to make sure the Calculate Value tool runs first.)
"{}, {}, {}".format(r"%River%", r"%Ditch%", r"%Flood type%")
", ".join([r"%River%", r"%Ditch%", r"%Flood type%"]) # same result
r"%River%" + ", " + r"%Ditch%" + ", " + r"%Flood type%" # same but ugly!
If you want to get really fancy with parameter validation you want to make a python script (.py or .pyt) with validation code and call your model from that script (ImportToolbox, call the model with arcpy). If you do this there are few limitations on how you set up your pick lists, you can even open datasets to dynamically create your picklists from the data if you want.
Customizing script tool behavior—Help | ArcGIS Desktop
Model Builder is pretty great but parameter validation is one thing that can force you to have to do at least part of your tool in Python.
Maybe I am reading too much into this. You can create hard coded pick lists of strings with parameter validation in the model properties for parameters River, Ditch, Flood type
Then you can use the Calculate Value tool with Python expressions like these, and then use the Calculate Value output model element in a Calculate Field string down the chain. (Tip: Use Precondition to make sure the Calculate Value tool runs first.)
"{}, {}, {}".format(r"%River%", r"%Ditch%", r"%Flood type%")
", ".join([r"%River%", r"%Ditch%", r"%Flood type%"]) # same result
r"%River%" + ", " + r"%Ditch%" + ", " + r"%Flood type%" # same but ugly!