ModelBuilder: add a spatial index to the data set output from change privileges

520
3
11-04-2013 07:36 PM
PierreWeisse
New Contributor
Hello,

I work with Modelbuilder in order to make a toolbox.
The objective is to update raster from a geodatabase to SDE.

At first I rename the existing raster in SDE

In a second time, I copy a raster update (the geodatabase to SDE).
Then change privileges (if necessary).

So far so good.

The third step is to add a spatial index to the data set output from change privileges

How can I do?

thank you
0 Kudos
3 Replies
DaleHoneycutt
Occasional Contributor III
Have you tried the Add Spatial Index tool?
0 Kudos
PierreWeisse
New Contributor
Hello Dayle

The problem is that I can not connect the output data set (edit privileges) to the input feature (add a spatial index).

Merci
0 Kudos
DaleHoneycutt
Occasional Contributor III
The output of Change Privileges has a data type of "composite", not "feature class".  This means you cannot directly connect the output of Change Privileges to a tool that expects a feature class, such as Add Spatial Index.

There are two workarounds:

1.  "Recast" the output to a data type of feature class. This is done with the Calculate Value tool.  To insert the Calculate Value tool into your model, choose Insert > Model only tools > Calculate Value from the ModelBuilder menu.

Attached is a screenshot of a simple model I made with the Calculate Value dialog box.

[ATTACH=CONFIG]28885[/ATTACH]

The Expression parameter is the name of the variable output by Change Privileges surrounded by percent signs (%).  (See inline variable substitution for more information about the percent signs)
The Data type parameter is Feature Class.
You can connect the output of Calculate Value to Add Spatial Index.

This technique will only work if there is only one input dataset to Change Privileges.  If you input two or more datasets to Change Privileges, the output will contain multiple datasets and you'll have to parse the output.

2. You could also use a precondition.  Using the precondition connector tool, connect the output of Change Privileges to the Add Spatial Index as a precondition, then connect the input to Change Privileges to Add Spatial Index.  This way, Change Privileges will execute before Add Spatial Index.
0 Kudos