pjldmo

Output to overwrite previous model run

Discussion created by pjldmo on Feb 16, 2011
I'm having a problem when I want an output to overwrite itself.  I've made the output a variable and it works if I validate the model every time I run it while it's in edit mode.  However, that's not the way I designed the model to work.  I've built a model to assist novice users in creating a soils map from a template.  The model clips a parcel from a county wide soils layer, adds a field (acres), puts this output into a geodatabase, calculates the acres and puts the output back into the geodatabase.  When each user opens the template, they add the desired layers, run the model, finish creating their map and print.  The model is set up where the output overwrites itself in the geodatabase so the corresponding layer in the map keeps the symbology.  I've made the output a variable but I get the red X when I do that.  I've tried making the output static and the model runs but returns no output?? Really can't figure that one.  Any one have any suggestions?

' ---------------------------------------------------------------------------
' SoilsTemplate.vbs
' Created on: Wed Feb 16 2011 11:11:03 AM
'   (generated by ArcGIS/ModelBuilder)
' Usage: SoilsTemplate <Property_shp> <soilmu_a_fl000_shp> <WRP_Soils>
' ---------------------------------------------------------------------------

' Create the Geoprocessor object
set gp = WScript.CreateObject("esriGeoprocessing.GPDispatch.1")

' Load required toolboxes...
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"
gp.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx"

' Script arguments...
Property_shp = wscript.arguments.item(0)
if Property_shp = "#" then
Property_shp = "C:\WRP_Templates\Property.shp" ' provide a default value if unspecified
end if

soilmu_a_fl000_shp = wscript.arguments.item(1)
if soilmu_a_fl000_shp = "#" then
soilmu_a_fl000_shp = "C:\WRP_Templates\soilmu_a_fl000.shp" ' provide a default value if unspecified
end if

WRP_Soils = wscript.arguments.item(2)
if WRP_Soils = "#" then
WRP_Soils = "C:\WRP_Templates\Soil.mdb\WRP_Soils" ' provide a default value if unspecified
end if

' Local variables...
WRP_Soils__2_ = "C:\WRP_Templates\Soil.mdb\WRP_Soils"
WRP_Soils__4_ = "C:\WRP_Templates\Soil.mdb\WRP_Soils"

' Process: Clip...
gp.Clip_analysis soilmu_a_fl000_shp, Property_shp, WRP_Soils, ""

' Process: Add Field...
gp.AddField_management WRP_Soils, "Acres", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", ""

' Process: Calculate Field...
gp.CalculateField_management WRP_Soils__2_, "Acres", "[Shape_area]*0.0002471", "VB", ""

Outcomes