Every quarter I will be replacing the two CSV files at the beginning of the model. I would like the final Excel file and feature class to each have a name that reflects the input CSV file name (please see model below). For the example below, I would like to have them renamed as: 2015Q1, as a reflection of the names of the input CSV files.
Is this possible to do?
I am not using 'iteration', which most of the similar questions are referring to.
enter image description here
1 Answer 1
I would recommend the Parse Path tool in ModelBuilder. Make sure to select the "Name" parse type. In this (very simplified) model, I included a "workspace" variable that I can call at any point and combine with the name value from the parse path output. The syntax for that would be %Workspace%\%Value%
in the output path parameter. You should also attach a precondition so that the parse path tool is in sync with the rest of the model.
enter image description here
-
How do I add a jpg (screenshot) here in comments? @Aaron, I tried Parse Path, connecting it from "2015Q1_B.csv" to both "copy features" and "table to excel". Neither one worked in modifying the final names. I had selected the "Name" parse type. I did not add workspace as I did not think it necessary (I could be wrong though). I used the preconditions as in your example.WolverineTime– WolverineTime2015年05月13日 18:43:41 +00:00Commented May 13, 2015 at 18:43
-
You would want to attach Parse Path to the input variable "2015Q1_B.CSV". Then simply attach
%Value%
to any output path (e.g.C:\path\to\some\folder\%Value%
. A precondition may not be necessary if you are not iterating through features.2015年05月13日 18:50:28 +00:00Commented May 13, 2015 at 18:50 -
I tried what you suggested but received an error message: ERROR 000210: Cannot create output: E:\GIS\Locations.gdb2015円Q1_B. Failed to execute (Copy Features (2)).WolverineTime– WolverineTime2015年05月13日 19:13:23 +00:00Commented May 13, 2015 at 19:13
-
Did you specify "Name" in the parse path tool?2015年05月13日 19:24:31 +00:00Commented May 13, 2015 at 19:24
-
Yes, I specified "NAME" in the parse type in Parse Path. Is there an issue with including '%' in a gdb pathname?WolverineTime– WolverineTime2015年05月13日 19:30:30 +00:00Commented May 13, 2015 at 19:30
Explore related questions
See similar questions with these tags.