Select Multi-Value and combine into one field

1059
2
Jump to solution
05-31-2017 04:27 PM
Greg_Mattis
Occasional Contributor II

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: 

  • River X
  • Y Ditch
  • Shallow Flooding
  •  etc

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

Greg Mattis, GISP
GIS Analyst
City of Visalia
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

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

Tutorial: Creating tools with ModelBuilder: Setting Filters on Model Parameters—Help | ArcGIS Deskto... 

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!

View solution in original post

0 Kudos
2 Replies
curtvprice
MVP Esteemed Contributor

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.

curtvprice
MVP Esteemed Contributor

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

Tutorial: Creating tools with ModelBuilder: Setting Filters on Model Parameters—Help | ArcGIS Deskto... 

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!
0 Kudos