<?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: SpatialQueryFilter() set up in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120692#M48369</link>
    <description>&lt;P&gt;After all, I wrote the mistake directly in the code.But thank you for the advice anyway.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2021 05:53:47 GMT</pubDate>
    <dc:creator>DavidMrázek</dc:creator>
    <dc:date>2021-11-29T05:53:47Z</dc:date>
    <item>
      <title>SpatialQueryFilter() set up</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120406#M48319</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I would like to ask how should I set the SpatialQueryFilter() to look for different values ​​in different columns in two layers. First FeatureLayer is "PlochyOsidleni_Final" and second is "intravilan_ZTM5".&lt;/P&gt;&lt;P&gt;In the first, I'm looking for a value 'Vysoký Chlumec' in the column "NAZ_CAST".&lt;/P&gt;&lt;P&gt;In the second value 'Víska' in the column "NAZEV".&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; var mv = MapView.Active;
            var plochy = "PlochyOsidleni_Final";
            var intravian = "intravilan_ZTM5";
            var str1 = "NAZ_CAST = 'Vysoký Chlumec'";
            var str2 = "NAZEV = 'Víska'";
            SpatialQueryFilter sqf = new SpatialQueryFilter()
            {
                WhereClause = str1 + str2,
                FilterGeometry = geometry,
               SpatialRelationship = SpatialRelationship.Contains
            };
            var features = mv.GetFeatures(geometry);
            var lyrI = mv.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()
                .FirstOrDefault(l =&amp;gt; l.Name == intravian);
            var lyrP = mv.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()
                .FirstOrDefault(l =&amp;gt; l.Name == plochy);
 List&amp;lt;FeatureLayer&amp;gt; editableLayers = new List&amp;lt;FeatureLayer&amp;gt;();
            editableLayers.Add(lyrP);
            editableLayers.Add(lyrI);
           
            foreach (FeatureLayer editableFeatureLayer in editableLayers)
            {
                Table fc = editableFeatureLayer.GetTable();
                int descriptionIndex = -1;
                descriptionIndex = fc.GetDefinition().FindField(plochy);
                using (var rowCursor = editableFeatureLayer.Select(sqf))//here show me error:'An invalid SQL statement was used.'

                {
                    var oid = rowCursor.GetObjectIDs();&lt;/LI-CODE&gt;&lt;P&gt;When I write it like this, it throws me a mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for all the advice and ideas.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 09:44:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120406#M48319</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-11-26T09:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: SpatialQueryFilter() set up</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120453#M48328</link>
      <description>&lt;P&gt;You do not say what the error message is or at what line it is occurring at, so how are people meant to help you?&lt;/P&gt;&lt;P&gt;That said I would imagine an error is cause by a malformed where clause:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;WhereClause = str1 + str2,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would that not resolves to:&amp;nbsp;"NAZ_CAST = 'Vysoký Chlumec'NAZEV = 'Víska'"&lt;/P&gt;&lt;P&gt;You need an AND or OR between these two statements, so it should be:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;WhereClause = str1 + " OR " + str2,&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Nov 2021 16:13:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120453#M48328</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-11-26T16:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: SpatialQueryFilter() set up</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120692#M48369</link>
      <description>&lt;P&gt;After all, I wrote the mistake directly in the code.But thank you for the advice anyway.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 05:53:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatialqueryfilter-set-up/m-p/1120692#M48369</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-11-29T05:53:47Z</dc:date>
    </item>
  </channel>
</rss>

