<?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 Select Layer By Attribute in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/select-layer-by-attribute/m-p/695604#M23047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good morning everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using geoprocessing within VBA (9.3 environment).&amp;nbsp; I am getting an automation error when trying to select attributes of a layer.&amp;nbsp; I have included code that I am trying.&amp;nbsp; Any thoughts?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Dim GP As Object
Set GP = CreateObject("esriGeoprocessing.GPDispatch.1")

GP.AddToolbox "C:/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"

GP.AddToolbox "C:/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx"


GP.OverwriteOutput = True


GP.MakeXYEventLayer_management "C:\File\Structure\tables\table.dbf", "Longitude", "Latitude", "Output_Layer", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];IsHighPrecision"

GP.FeatureClassToShapefile_conversion "Output_Layer", "C:\File\Structure"


GP.Project_management "C:\File\Structure\Output_Layer.shp", "C:\File\Structure\New_Output.shp", "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]]", "OSGB_1936_To_WGS_1984_Petroleum", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"


GP.SelectLayerByAttribute_management "C:\File\Structure\New_Output.shp", "NEW_SELECTION", "TYPE = 'W'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Feature Class To Shp was put in to try and solve the problem, but didn't, so I realise that might not need to exist.&amp;nbsp; The final shp is created but the selection is not run on it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Dec 2011 08:33:42 GMT</pubDate>
    <dc:creator>StephenBell3</dc:creator>
    <dc:date>2011-12-22T08:33:42Z</dc:date>
    <item>
      <title>Select Layer By Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-layer-by-attribute/m-p/695604#M23047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good morning everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using geoprocessing within VBA (9.3 environment).&amp;nbsp; I am getting an automation error when trying to select attributes of a layer.&amp;nbsp; I have included code that I am trying.&amp;nbsp; Any thoughts?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Dim GP As Object
Set GP = CreateObject("esriGeoprocessing.GPDispatch.1")

GP.AddToolbox "C:/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"

GP.AddToolbox "C:/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx"


GP.OverwriteOutput = True


GP.MakeXYEventLayer_management "C:\File\Structure\tables\table.dbf", "Longitude", "Latitude", "Output_Layer", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];IsHighPrecision"

GP.FeatureClassToShapefile_conversion "Output_Layer", "C:\File\Structure"


GP.Project_management "C:\File\Structure\Output_Layer.shp", "C:\File\Structure\New_Output.shp", "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]]", "OSGB_1936_To_WGS_1984_Petroleum", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"


GP.SelectLayerByAttribute_management "C:\File\Structure\New_Output.shp", "NEW_SELECTION", "TYPE = 'W'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Feature Class To Shp was put in to try and solve the problem, but didn't, so I realise that might not need to exist.&amp;nbsp; The final shp is created but the selection is not run on it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 08:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-layer-by-attribute/m-p/695604#M23047</guid>
      <dc:creator>StephenBell3</dc:creator>
      <dc:date>2011-12-22T08:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Select Layer By Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-layer-by-attribute/m-p/695605#M23048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think the only change you need to make is in your query statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;GP.SelectLayerByAttribute_management "C:\File\Structure\New_Output.shp", "NEW_SELECTION", &lt;STRONG&gt;"\"TYPE\" = 'W'"&lt;/STRONG&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The column name for the selection needs to be enclosed in double quotes as well as the entire expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lookup the article, "About building an SQL expression" in the desktop help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 15:39:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-layer-by-attribute/m-p/695605#M23048</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2011-12-22T15:39:53Z</dc:date>
    </item>
  </channel>
</rss>

