<?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: Comparing field values to file names in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342089#M1107</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: SStrand&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is populated with the path to the .jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc etc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2011 17:13:40 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2011-06-15T17:13:40Z</dc:date>
    <item>
      <title>Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342087#M1105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: SStrand&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a shapefile which has a hyperlink field populated with .jpg files. What I would like to do is have a python script check the hyperlink field against the folder full of .jpg files to make sure that everything will be linking correctly. Any help would be much appreciated!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 16:09:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342087#M1105</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-15T16:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342088#M1106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdharles&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you give an example of what the hyperlink field looks like.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 17:03:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342088#M1106</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-15T17:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342089#M1107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: SStrand&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is populated with the path to the .jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc etc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 17:13:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342089#M1107</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-15T17:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342090#M1108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Something like this should do it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

arcpy.env.workspace = os.getcwd()

# shapefile that contains hyperlink
shp = "myfile.shp"

# Create SearchCursor for feature class.
rows = arcpy.SearchCursor(shp)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get the path to the file from field 'hyperlink'
&amp;nbsp;&amp;nbsp;&amp;nbsp; path = row.getValue("hyperlink")&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Does that file exist?
&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Link is OK: "+path
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "BROKEN LINK!: "+path
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
del rows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:08:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342090#M1108</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T16:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342091#M1109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: SStrand&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much R.D.!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 17:42:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342091#M1109</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-15T17:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342092#M1110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey, I'm actually trying to do something very similar. I am trying to compare files names from a field called 'PHOTOS' (a string field containing the files names of photos or jpg's). If the record doesn't have a photo name, it will have the string "N/A") and I want to cross reference those names with the file names in a folder. If they match, I want to copy them to another folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above script works great on my file gdb and I can print out the file names. I went further and tried to test for count, but the count function will not work. I think I have my syntax wrong, but I have honestly spent 2 days on tyhis now with various combinations of code and I am getting different errors every time.....this was easier in 9.3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os

arcpy.env.workspace = os.getcwd()

# Feature Class that contains PHOTOS field
shp = "Z:\ESRI\Geodatabase\TEST.gdb\point_FC"

# Create SearchCursor for feature class.
rows = arcpy.SearchCursor(shp)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # the print path syntax works fine, it's the count that fails....
&amp;nbsp;&amp;nbsp;&amp;nbsp; path = row.getValue("PHOTOS")&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print path
&amp;nbsp;&amp;nbsp;&amp;nbsp; if path != "N/A":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.GetCount_management(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
del rows

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:08:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342092#M1110</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2021-12-11T16:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342093#M1111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdharles&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm confused, what are you trying to get a count of?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 17:38:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342093#M1111</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-16T17:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342094#M1112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Mike, &lt;BR /&gt;I'm confused, what are you trying to get a count of?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to get a count of all the records in the "PHOTOS" field that DO NOT have the value 'N/A" in them....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 17:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342094#M1112</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2011-06-16T17:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342095#M1113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdharles&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's how to do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.) Do a MakeFeatureLayer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.) make a selection (SelectLayerByLocation) where PHOTOS != "N/A"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.) Finally, do the GetCount, but in 10.x, it has to look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result = str(arcpy.GetCount_management(FILENAME).getOutput(0) )&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 18:04:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342095#M1113</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-16T18:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342096#M1114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey R.D. Thanks a bunch for the tip. I had used this method earlier but I kept getting error. I had narrowed it down to the !=. The selectbyattributes where clause does not like that operator for NOT EQUALS, which is weird, because I have used it in other SQL queries in python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After your post, I finally clued in to use &amp;lt;&amp;gt; and that works perfectly. Sometimes it's nice to just have someone jog your memory!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 18:29:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342096#M1114</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2011-06-16T18:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing field values to file names</title>
      <link>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342097#M1115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdharles&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hey R.D. Thanks a bunch for the tip. I had used this method earlier but I kept getting error. I had narrowed it down to the !=. The selectbyattributes where clause does not like that operator for NOT EQUALS, which is weird, because I have used it in other SQL queries in python.&lt;BR /&gt;&lt;BR /&gt;After your post, I finally clued in to use &amp;lt;&amp;gt; and that works perfectly. Sometimes it's nice to just have someone jog your memory!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Strange that &amp;lt;&amp;gt; works and != does not work!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I read in some Esri doc a while back that != has replaced &amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess not everywhere???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 18:36:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/comparing-field-values-to-file-names/m-p/342097#M1115</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-06-16T18:36:42Z</dc:date>
    </item>
  </channel>
</rss>

