Re: Iterating through a Geodatabase using a script to identify feature class names

502
2
07-11-2017 04:32 AM
DuncanHornby
MVP Notable Contributor

Try this:

  1. Get rid of your existing Name check script tool.
  2. Connect you featureclass created by the iterator to all 3 make featurelayer tools. 
  3. Use the model only Calculate Value tool with your code and make that a precondition to the make featurelayer tool. You would have 3 Calculate Value tools 1 for each make feature layer tool, all acting as preconditions, each testing for a specific name.
0 Kudos
2 Replies
MattDeveney
New Contributor III

Hello,

So I tried your suggestion and I am receiving the following error: 

Here is my model stripped down to one line, from 44, (the full model tests each layer name for 44 possible names so that the correct symbology can be applied):

And my script in Calculate Value to identify the names of the input feature classes in order to determine the correct symbology:

Any help would be appreciated.

0 Kudos
curtvprice
MVP Esteemed Contributor

I think you can simplify further, if your symbology layer files named the same as your feature class names? Connect the model element Name to the Make Feature Layer tool layer Name parameter, for the Save To Layer file tool specify the output as: %Name%_sym.lyr. Put your pre-symbolized layer files in a folder (create a Folder variable Symbology Folder to point to this folder of .lyr files), and supply the path to them as input to the Apply Symbology From Layer tool (you should need only one, not 44) using this syntax:

%Symbology Folder%\%Name%_sym.lyr‍‍‍‍‍

This approach avoids your 44 chains with preconditions, you can just construct the paths directly on each iteration as needed, all in one processing chain.

0 Kudos