<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: missing link between toolbox and tool in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/missing-link-between-toolbox-and-tool/m-p/144005#M467</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you still can't get this external tool to use try the following script which do basicaly the same. You can then incorporate it in your script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting, os
gp = arcgisscripting.create(9.3)

inputFC = r"Z:\TestSHP\geogrC001.shp"
fieldName ="C001"
outWorkspace = r"Z:\Work\TestSHPout"
filePrefix ="geor" + fieldName[1:] #eg. geor001

#find a type of declared field
fields = gp.ListFields(inputFC, fieldName)
fieldType = fields[0].Type


#create a list of values in declared field
valuesLst = []
searchCursor = gp.SearchCursor(inputFC, "", None, fieldName)
row = searchCursor.next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; valuesLst.append(row.getValue(fieldName))
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = searchCursor.next()
del searchCursor

#make the list unique
uniqueValuesLst = set(valuesLst)


#create new feature class for each unique value
for value in uniqueValuesLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #build output feature class path
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFCName = filePrefix + "_" + str(value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFC = os.path.join(outWorkspace, outFCName)

&amp;nbsp;&amp;nbsp;&amp;nbsp; #build SQL WHERE clause depending :
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fieldType == "String":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = fieldName + " = '%s'" % value
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = fieldName + " = %s" %value

&amp;nbsp;&amp;nbsp;&amp;nbsp; #extract values to new feature classes
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Select_analysis(inputFC, outFC, whereClause)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:53:50 GMT</pubDate>
    <dc:creator>MarcinGasior</dc:creator>
    <dc:date>2021-12-11T07:53:50Z</dc:date>
    <item>
      <title>missing link between toolbox and tool</title>
      <link>https://community.esri.com/t5/transportation-questions/missing-link-between-toolbox-and-tool/m-p/144004#M466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;System ArcGIS 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Windows Vista&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to run a arcscript (as attached) to do batch work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the error always showed that environment or tool not found. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(gp.SplitByAttribute(inputFC, fieldName, outputWS, filePrefix) AttributeError: Object: Tool or environment not found)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please kindly help check if the following code is correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If so, please kindly advise if it is possible to have missing link between the toolbox and tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS shapefile is also attached in test1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; ##Script Name: split rows
##Description: using 
##Created By: Elaine Kuo
##Date: 23/09/2012


#Import standard library modules
import arcgisscripting
import os

#Create the Geoprocessor object
gp = arcgisscripting.create(9.3)


#Set the workspace.
gp.Workspace= "H:/temp/test1"


#Set the workspace. List all of the feature classes in the dataset
outWorkspace= "H:/temp/test1"

inputFC = "H:/temp/test1/geor0247_Dissolve.shp"
fieldName = "C0247"
outputWS = "H:/temp/test1"
filePrefix = "geor0427"


# Add a toolbox with a model to the geoprocessor and set the workspace
gp.AddToolbox("C:/TEMP/AdditionalAnalysis/Additional Analysis - Generic Tools.tbx")



#### Execute Script Tool ###
gp.SplitByAttribute(inputFC, fieldName, outputWS, filePrefix)
&amp;nbsp; 

gp.AddMessage(gp.GetMessages())
print gp.GetMessages()

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/missing-link-between-toolbox-and-tool/m-p/144004#M466</guid>
      <dc:creator>ElaineKuo</dc:creator>
      <dc:date>2021-12-12T16:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: missing link between toolbox and tool</title>
      <link>https://community.esri.com/t5/transportation-questions/missing-link-between-toolbox-and-tool/m-p/144005#M467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you still can't get this external tool to use try the following script which do basicaly the same. You can then incorporate it in your script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting, os
gp = arcgisscripting.create(9.3)

inputFC = r"Z:\TestSHP\geogrC001.shp"
fieldName ="C001"
outWorkspace = r"Z:\Work\TestSHPout"
filePrefix ="geor" + fieldName[1:] #eg. geor001

#find a type of declared field
fields = gp.ListFields(inputFC, fieldName)
fieldType = fields[0].Type


#create a list of values in declared field
valuesLst = []
searchCursor = gp.SearchCursor(inputFC, "", None, fieldName)
row = searchCursor.next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; valuesLst.append(row.getValue(fieldName))
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = searchCursor.next()
del searchCursor

#make the list unique
uniqueValuesLst = set(valuesLst)


#create new feature class for each unique value
for value in uniqueValuesLst:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #build output feature class path
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFCName = filePrefix + "_" + str(value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFC = os.path.join(outWorkspace, outFCName)

&amp;nbsp;&amp;nbsp;&amp;nbsp; #build SQL WHERE clause depending :
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fieldType == "String":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = fieldName + " = '%s'" % value
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = fieldName + " = %s" %value

&amp;nbsp;&amp;nbsp;&amp;nbsp; #extract values to new feature classes
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Select_analysis(inputFC, outFC, whereClause)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:53:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/missing-link-between-toolbox-and-tool/m-p/144005#M467</guid>
      <dc:creator>MarcinGasior</dc:creator>
      <dc:date>2021-12-11T07:53:50Z</dc:date>
    </item>
  </channel>
</rss>

