I have been developing a detailed demographic profiling model that allows users to draw a user defined area and pull back a demographic profile.
Within the main model there is a sub-model (DataPrep) that contains a .py script that runs a series of key data prep routines (adding new columns, calculations, transposing etc) to produce the final table. Within this sub-model I then have another sub-model that contains the 'Table to Excel' tool - this take the final table and exports it to an excel file. This all works fine and the overall model runs in the correct order.
However, if I make the output from the 'Table to Excel' tool a parameter it causes the 'Table to Excel' tool to run before the .py script that does all of prep work on the data.I need to have the output of the 'Table to Excel' as a parameter in the main model as I am using this model to publish as a service for a geo-processing widget in a Javascript viewer.
Is there a way to prevent this from happening?
appreciate any comments
Justin
are you relying on the 'bubbles' to determine whether the model parameters are in the correct order or have you examined them as they really are arranged?
Changing model parameter order—Help | ArcGIS for Desktop
Sometimes, looks can be deceiving, especially if edits/rearrangements were made while building the model.
Hi Dan,
I'm only getting back to looking at this now. I've looked at different options and now think that it seems to be possible to pass out a parameter from the python script tool. I could then use this to connect to my Table to Excel tool.
Having tried a few things I have got the model working properly but when I publish to Server and then try and run I get an error saying that one of the files is not available (error log below). I'm sure something is not correct when trying to set my output parameter from the script.
The snippet of script below shows what I am doing. After all the required processing the final table I need is "ThemesIndicators_1". I then make a copy of this and call it "GeoProfile" and set it as the second parameter. This is then set as an Output parameter and set as Derived. I then use the GeoProfile parameter to link to the Table to Excel.
arcpy.DeleteField_management("ThemesIndicators_1", ["IndCode"])
arcpy.Copy_management("ThemesIndicators_1", "GeoProfile")
arcpy.SetParameterAsText(0, "PopSummary")
arcpy.SetParameterAsText(1, "GeoProfile")
except:
pass
The error log I get is as follows:
Error executing tool. GeoProfile_RoI_1 Job ID: ja6f026ab686b4517b76521ac646cd166 : ERROR 000732: Input Table: Dataset c:\arcgisserver\directories\arcgisjobs\geoprocessing_dev\airogeoprofile_roi_gpserver\ja6f026ab686b4517b76521ac646cd166\scratch\scratch.gdb\GeoProfile does not exist or is not supported Failed to execute (Table To Excel).
Any advice would be great
Thanks
Have you tried setting the PrepData submodel as a precondition to the model containing the Table to Excel tool? Otherwise have you tried modifying your submodels so that you can leverage the output of one as input to another? This would ensure that the models always run in the order you're needing.