<?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: Calculate field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field/m-p/1503462#M85404</link>
    <description>&lt;P&gt;You could just do &lt;EM&gt;Select By Attributes &lt;/EM&gt;and look at the number of selected features, couldn't you? But to do it in Arcade, there isn't a direct equivalent to that function. We can recreate it with GroupBy and some SQL:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sql = `CASE WHEN field1 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field2 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field3 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field4 = 'NO OK' THEN 1 ELSE 0 END`

var grouped = GroupBy(
  $layer, // or some FeatureSetBy… function, depends on how you're pulling this data into your expression
  'objectid',
  { name: 'no_ok_count', expression: sql, statistic: 'SUM' }
)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 10 Jul 2024 12:39:22 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2024-07-10T12:39:22Z</dc:date>
    <item>
      <title>Calculate field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field/m-p/1503454#M85403</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to calculate the number of fields that contain a specific text. In excel it would be something like this:&lt;BR /&gt;=CONTAR.SI(A2:AG2;" NO OK")&lt;BR /&gt;Can you tell me what the expression with Arcade would be?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 12:12:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field/m-p/1503454#M85403</guid>
      <dc:creator>Ainosez</dc:creator>
      <dc:date>2024-07-10T12:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field/m-p/1503462#M85404</link>
      <description>&lt;P&gt;You could just do &lt;EM&gt;Select By Attributes &lt;/EM&gt;and look at the number of selected features, couldn't you? But to do it in Arcade, there isn't a direct equivalent to that function. We can recreate it with GroupBy and some SQL:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sql = `CASE WHEN field1 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field2 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field3 = 'NO OK' THEN 1 ELSE 0 END +
  CASE WHEN field4 = 'NO OK' THEN 1 ELSE 0 END`

var grouped = GroupBy(
  $layer, // or some FeatureSetBy… function, depends on how you're pulling this data into your expression
  'objectid',
  { name: 'no_ok_count', expression: sql, statistic: 'SUM' }
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jul 2024 12:39:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field/m-p/1503462#M85404</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-10T12:39:22Z</dc:date>
    </item>
  </channel>
</rss>

