<?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: SearchCursor within Modelbuilder not filtering in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274721#M67521</link>
    <description>&lt;P&gt;You have set the parameters to the model variables but you have not set the model variables, I know this as they are grey. Right click on them, open them in your model and set them to the actual dataset.&lt;/P&gt;&lt;P&gt;Also looking at your code you have hard wired the SQL where clause to event_id, so why offer it up as a parameter?&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2023 15:18:51 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2023-04-03T15:18:51Z</dc:date>
    <item>
      <title>SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274693#M67514</link>
      <description>&lt;P&gt;I have a working model that filters data down to a few layer files. I also have a working python script that will take those filtered layers and further filter them. As of now I have to run the model and then run the script, I'm trying to merge the processes for efficiency. When I drag the script into Modelbuilder or try to create another model to do a model within a model, the process will run except the searchcursor won't do any "searching."&lt;/P&gt;&lt;P&gt;Heres the Script&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import os
import sys
import arcpy
Workspace = arcpy.GetParameterAsText(0) # Workspace
Points_Filtered = arcpy.GetParameterAsText(1) # Feature Layer
Event_id = arcpy.GetParameterAsText(2) # Event_ID
RTL_Unfiltered = arcpy.GetParameterAsText(3) # Feature Layer
FP1 = os.path.abspath(Workspace)
outputFile =  fr"{FP1}\RTL_Filtered"
events = arcpy.da.SearchCursor(Points_Filtered, Event_id)
unique_events = list(set([row[0] for row in events]))
sql = "event_id IN(" + ','.join(map(str, unique_events)) + ")"
arcpy.management.SelectLayerByAttribute(RTL_Unfiltered, "NEW_SELECTION", sql, None)
arcpy.management.CopyFeatures(RTL_Unfiltered, outputFile, '', None, None, None)
arcpy.SetParameterAsText(4, outputFile)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274693#M67514</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-04-03T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274702#M67515</link>
      <description>&lt;P&gt;Are you saying in the image you have uploaded that "SearchCursor" is a model? Also the inputs to&amp;nbsp;"SearchCursor" are all grey, they have not been set, so not surprising that&amp;nbsp;"SearchCursor" is not running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is little point setting them as Parameters if you intend to run the model within modelbuilder.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:40:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274702#M67515</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-04-03T14:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274707#M67516</link>
      <description>&lt;P&gt;Its just a picture to show that portion of the process since my model is a little more complex. The model stays gray since it requires user input when ran even when all the parameter's are defined/connected.&lt;/P&gt;&lt;P&gt;The process runs just the searchcursor portion of the script doesn't work when inserted into the model.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:47:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274707#M67516</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-04-03T14:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274708#M67517</link>
      <description>&lt;P&gt;OK, without seeing what&amp;nbsp;"SearchCursor" is no one can answer this question. I suspect the inputs are the wrong data type that they are feeding into. Share that portion of the model with some sample data?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:53:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274708#M67517</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-04-03T14:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274709#M67518</link>
      <description>&lt;LI-CODE lang="c"&gt;import os
import sys
import arcpy
Workspace = arcpy.GetParameterAsText(0) # Workspace
Points_Filtered = arcpy.GetParameterAsText(1) # Feature Layer
Event_id = arcpy.GetParameterAsText(2) # Event_ID
RTL_Unfiltered = arcpy.GetParameterAsText(3) # Feature Layer
FP1 = os.path.abspath(Workspace)
outputFile =  fr"{FP1}\RTL_Filtered"
events = arcpy.da.SearchCursor(Points_Filtered, Event_id)
unique_events = list(set([row[0] for row in events]))
sql = "event_id IN(" + ','.join(map(str, unique_events)) + ")"
arcpy.management.SelectLayerByAttribute(RTL_Unfiltered, "NEW_SELECTION", sql, None)
arcpy.management.CopyFeatures(RTL_Unfiltered, outputFile, '', None, None, None)
arcpy.SetParameterAsText(4, outputFile)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:54:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274709#M67518</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-04-03T14:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274714#M67519</link>
      <description>&lt;P&gt;You Script tool (so not model) code takes 4 parameters, in your image you are not connecting in Event_id, the 3rd of 4.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Event_id = arcpy.GetParameterAsText(2) # Event_ID&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which suggests your current parameters are potentially linking to the wrong input parameter as well as not providing all four required parameters?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:02:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274714#M67519</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-04-03T15:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274715#M67520</link>
      <description>&lt;P&gt;It's set in the paramaters. Do I need to change the Script?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274715#M67520</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-04-03T15:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274721#M67521</link>
      <description>&lt;P&gt;You have set the parameters to the model variables but you have not set the model variables, I know this as they are grey. Right click on them, open them in your model and set them to the actual dataset.&lt;/P&gt;&lt;P&gt;Also looking at your code you have hard wired the SQL where clause to event_id, so why offer it up as a parameter?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 15:18:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274721#M67521</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-04-03T15:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: SearchCursor within Modelbuilder not filtering</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274787#M67534</link>
      <description>&lt;P&gt;Are you actually entering the the field name for Event_id on line 6?&amp;nbsp; That is what you are telling the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_self"&gt;search cursor&lt;/A&gt; on line 10.&amp;nbsp;&lt;/P&gt;&lt;P&gt;First input is dataset, second is field list.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:52:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/searchcursor-within-modelbuilder-not-filtering/m-p/1274787#M67534</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-04-03T16:52:13Z</dc:date>
    </item>
  </channel>
</rss>

