Changing inline variable %name% in ModelBuilder of ArcMap

arcgis-desktoparcmapmodelbuilderspatial-analystzonal statistics

I have a lot of MODIS tif files in a folder and I want to calculate zonal statistics of each tiff file according to polygon in my shapefile. I am trying this in ModelBuilder of ArcMap 10.3.1
Model Builder in Arcmap 10.3.1

However, It's giving me this error:
Error

I google alot and find inline variable name in zonal statistics throwing me error by using %name%. I google for solution and some posts suggest me to use collect value and parse path. I am using ArcMap 10.3.1 not find parse path function and also not able to apply correctly collect value.

How can I find zonal statistics of bluck of tif files according to my shapefile in ArcMap?

This processing should be automatic to reduce my time.

Editing 1 After Suggestions on this Question:

After Suggestions of Parse Path

Getting this Error:
enter image description here

Will you please help How to use Parse Path Tool. I've given parse tool output as precondition to Zonal statistics and the above error was come. How can I remove this please?

Editing No 2:

Editing 2 is done in 3 steps:
Step 1: Using raster iterator I am accessing Correct_ET folder till 2002001.tif (Green circle) and description of iterator is given in the picture below:Raster Iterator

Step 2: In this step I'm using Parse tool and giving green cirle (2002001.tif) as input and selecting name in Parse tool as shown in picture below:
Complete information of Parse Path tool

Step 3:
final, I am giving 2002001.tif as input raster and District as shapefile which has attribute District_n (Admin polygon) and Setting output path of table in seperate folder EET with %name% as shown below:Zonal Statistics Complete information

the Output (Value circle) is given as precondition input to zonal statistics however, the errors remains the same? All this complete information is model share in editing 1 of this question

Best Answer

Firstly rename the output of the iterator to something like "Raster" rather than 2002001.tif, just makes things clearer to understand.

Using %Name% as your inline variable substitution is taking the name of the raster from the iterator (the light blue bubble) which would of course be something like "2002001.tif". I'm guessing in the zonal stats tool your output table parameter is set to something like J:\..filepath...\%Name%

Well the substitution would create a table name ending with .tif which would be invalid as @BERA indicates in the comments. You need to rebuild the table name to something like 2002001.dbf.

dbf is a valid table name extension name. Your output table would be in a dBase format.

Use Parse Path tool to return the name part and lets assume its output is called NewName. Parse Path tool needs to be a precondition to the zonal stats tool. So finally in the zonal stats tool your output table parameter would something like J:\..filepath...\%NewName%.dbf

Related Question