Using a string variable as the model parameter to determine input in Model Builder

385
4
Jump to solution
10-08-2013 10:41 AM
BenjaminBauman
Occasional Contributor
Hi there,

My model requires an input file that varies depending on the week number. I want the model to prompt the user for the week number (e.g., 'clm20130518') before the process is triggered. My model incorporates several Python scripts in addition to the geocoding and spatial join tools. I want all intermediate files in addition to the output file names to also contain the week number variable provided by the user. However, when I run the model and provide the week number at the prompt, I get an error message stating the following:

Error 000732: Input Table: Dataset
Path\to\file\%file_prefix%.georeq.il.ides.csv does not exist or is not supported.

It looks as if the geocoding tool is looking for an input the moment the model runs. However, this input isn't created until the previous step (a Python process) is complete. I tried to set the Python process as a precondition to the geocoding process, but I encountered the same error. Also, for whatever reason, I cannot use the output csv file from the Python process as an input to the geocode. It only accepts it as a precondition.

Please take a look at the image of the model attached to this post. Thanks!
0 Kudos
1 Solution

Accepted Solutions
BenjaminBauman
Occasional Contributor
It pops up immediately. I didn't test your theory, but I resorted to a hack workaround - creating a copy of the output from the second Python script and converting it to a (preexisting) fixed file name via the Copy tool. Thank you both for your input.

View solution in original post

0 Kudos
4 Replies
JimCousins
MVP Regular Contributor
Not overly familiar with this, but can right click in the model and create a variable, and use this as the placeholder and source for the week number?
Jim
0 Kudos
BenjaminBauman
Occasional Contributor
Yea, that's the way it's set up right now. I then set this variable as the model parameter.
0 Kudos
JimCousins
MVP Regular Contributor
Perhaps it is an issue with the multiple "." in the filename?
Will your first portion of the model (Validator) run standalone, or does the error popup immediately?
0 Kudos
BenjaminBauman
Occasional Contributor
It pops up immediately. I didn't test your theory, but I resorted to a hack workaround - creating a copy of the output from the second Python script and converting it to a (preexisting) fixed file name via the Copy tool. Thank you both for your input.
0 Kudos