<?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: frequency tool in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482881#M16202</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right I get it... as Amanda (circa 2007) states, there is no way to do this except to create a concatenated field in the input and output tables. Not that much overhead though really.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another option I use a lot is to populate a Python dictionary such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;relateDictionary = {(1,2) = "cat", (2,2) = "dog"}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;where 1,2 and 2,2 are unique combinations of the relate keys, but that requires some programming using a search and update cursor...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Jan 2012 02:07:44 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2012-01-07T02:07:44Z</dc:date>
    <item>
      <title>frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482877#M16198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know why the case_item field was eliminated from the frequency tool in ArcGIS Desktop? In ArcInfo Workstation the option to add a case_item made it very easy to join the frequency table to the feature table. This question was initially asked in 2007 (&lt;/SPAN&gt;&lt;A href="http://forums.esri.com/thread.asp?c=93&amp;amp;f=1729&amp;amp;t=233587"&gt;http://forums.esri.com/thread.asp?c=93&amp;amp;f=1729&amp;amp;t=233587&lt;/A&gt;&lt;SPAN&gt;), but did not get a response.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 19:12:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482877#M16198</guid>
      <dc:creator>SandraMargriter</dc:creator>
      <dc:date>2012-01-06T19:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482878#M16199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Does anyone know why the case_item field was eliminated from the frequency tool in ArcGIS Desktop? In ArcInfo Workstation the option to add a case_item made it very easy to join the frequency table to the feature table. This question was initially asked in 2007 (&lt;A href="http://forums.esri.com/thread.asp?c=93&amp;amp;f=1729&amp;amp;t=233587"&gt;http://forums.esri.com/thread.asp?c=93&amp;amp;f=1729&amp;amp;t=233587&lt;/A&gt;), but did not get a response.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That does seem like a useful behavior.&amp;nbsp; Since not all source feature classes can have their schemas altered (SDE won't allow it without priveleges) the option should be added to the Desktop tool but be greyed out if the user lacks rights to alter the source schema.&amp;nbsp; I also suppose that locks on the source by other users are hard to detect and would cause that option to fail, so the tools was simplified to allow it to work without much chance of generating errors.&amp;nbsp; The Make Query Table tool is the only option for doing this kind of join in Desktop, but it has to be in the same geodatabase to work and cannot be edited, so if you can use that tool it has to be exported to create the joinable bridge table.&amp;nbsp; That is not as elegant of an approach.&amp;nbsp; Concatenating the fields together in a new field that is in both the source and output is the only other option to create a join.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should vote for &lt;/SPAN&gt;&lt;A href="https://c.na1.visual.force.com/apex/ideaView?id=08730000000bmhxAAA"&gt;this idea&lt;/A&gt;&lt;SPAN&gt; and similar ideas on the ideas website.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 19:38:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482878#M16199</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-01-06T19:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482879#M16200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use the SummaryStatistics tool: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001z000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001z000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It does everything that Frequecy does and more...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 22:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482879#M16200</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-01-06T22:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482880#M16201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Use the SummaryStatistics tool: &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001z000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001z000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;It does everything that Frequecy does and more...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that it does everything that Frequency does and more, but it still does not add a case item field to the source if the output has more than one case field.&amp;nbsp; That functionality would be a good enhancement so that Relationship Classes can be established for correlating many fields to a single join field.&amp;nbsp; So I still recommend voting for the idea I mentioned to request that enhancement.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jan 2012 00:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482880#M16201</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-01-07T00:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482881#M16202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right I get it... as Amanda (circa 2007) states, there is no way to do this except to create a concatenated field in the input and output tables. Not that much overhead though really.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another option I use a lot is to populate a Python dictionary such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;relateDictionary = {(1,2) = "cat", (2,2) = "dog"}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;where 1,2 and 2,2 are unique combinations of the relate keys, but that requires some programming using a search and update cursor...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jan 2012 02:07:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482881#M16202</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-01-07T02:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: frequency tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482882#M16203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I miss this function too, especially when attempting to port&amp;nbsp; AML code to&amp;nbsp; Python tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a python script&amp;nbsp; that&amp;nbsp; I called FrequencyWithCase to add back the functionality.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It was not too hard, I can add the case ID as the records are read in a single pass updateCursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# FrequencyWithCase.py
# do it properly ESRI
# 19 May 2010
# add a case item to the source table
# like Workstation

import arcgisscripting,sys,os

try :
&amp;nbsp;&amp;nbsp;&amp;nbsp; table = sys.argv[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; strFields = sys.argv[2]
except :
&amp;nbsp;&amp;nbsp;&amp;nbsp; table = "e:/data/nzpost/paf2010/geopaf.gdb/pafpost"
&amp;nbsp;&amp;nbsp;&amp;nbsp; strFields = "postcode;postcode_1"

gp = arcgisscripting.create(9.3)
casefld = "case"
ws = os.path.dirname(table)
tabname = os.path.basename(table)

gp.Workspace = ws

if len(gp.Listfields(table,casefld)) == 0 :
&amp;nbsp;&amp;nbsp;&amp;nbsp; result = gp.AddField(table,casefld,"LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print result.GetOutput(0)
else :
&amp;nbsp;&amp;nbsp;&amp;nbsp; # name = gp.AddField(table,"case1","LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print casefld,"Exists"
if gp.ListFields(table,casefld) == None :
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise Exception,"no case field"
seqfld = 'sequence'
if len(gp.Listfields(table,seqfld)) == 0 :
&amp;nbsp;&amp;nbsp;&amp;nbsp; result = gp.AddField(table,seqfld,"LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print result.GetOutput(0)
else :
&amp;nbsp;&amp;nbsp;&amp;nbsp; # name = gp.AddField(table,"case1","LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print seqfld,"Exists"
if gp.ListFields(table,seqfld) == None :
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise Exception,"no sequence field"
# make a dictionary with a combo key
# populate the source table as we go
# export the dictionary at the end

# make a tuple of all fields
# check if its in dictionary
# if it is increment counter
# otherwise add new entry
# retrieve number
# put number into index or back on table

# 
dFreq = {}
lstFields = strFields.split(";")
print lstFields
cur = gp.UpdateCursor(table)
row = cur.next()
n = 0
ccase = 0
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; combo = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in lstFields :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; combo.append( row.GetValue(f) )
&amp;nbsp;&amp;nbsp;&amp;nbsp; combo = tuple(combo)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if dFreq.has_key(combo) :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thiscase,freq = dFreq[combo]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dFreq[combo] = (thiscase,freq+1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.case = thiscase
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.sequence = freq+1
&amp;nbsp;&amp;nbsp;&amp;nbsp; else :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ccase+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dFreq[combo] = (ccase,1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.case = ccase
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.sequence = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.UpdateRow(row)
##&amp;nbsp;&amp;nbsp;&amp;nbsp; if n &amp;gt; 1000 :
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp; n+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.next()
del cur,row
print

print "case freq"
keytab = dFreq.values()
keytab.sort()
##for x in keytab:
##&amp;nbsp;&amp;nbsp;&amp;nbsp; print "%4d %4d" % x
print len(dFreq),"cases"

# write out frequency table with case item

fTab = tabname+"Freq"
if gp.Exists(fTab) :
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Delete(fTab)
gp.CreateTable(ws,fTab)
gp.AddField(fTab,casefld,"LONG")
gp.AddField(fTab,"Frequency","LONG")
dscTable = gp.Describe(table)
dType = {"String":"TEXT","Integer":"LONG"}
for f in lstFields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fType = dType[gp.ListFields(table,f)[0].type]
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddField(fTab,f,fType) # may not be a "long" in general case
&amp;nbsp;&amp;nbsp;&amp;nbsp; print f,"added to",fTab&amp;nbsp;&amp;nbsp;&amp;nbsp; 
cur = gp.InsertCursor(fTab)
for k in dFreq.keys():
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## print dFreq&lt;K&gt;[0],dFreq&lt;K&gt;[1],dFreq&lt;K&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.NewRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.case = dFreq&lt;K&gt;[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Frequency = dFreq&lt;K&gt;[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; n = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in k:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##print i,n,lstFields&lt;N&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld = lstFields&lt;N&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.SetValue(fld, i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.InsertRow(row)
del cur,row
print "Done"&lt;/N&gt;&lt;/N&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:18:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/frequency-tool/m-p/482882#M16203</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2021-12-11T21:18:48Z</dc:date>
    </item>
  </channel>
</rss>

