<?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: Extract Value Across Multiple Columns in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099136#M226</link>
    <description>&lt;P&gt;Okay I see. This is a great example, thank you. I'll just have to find the equivalent of str.contains for Arcade, then parse out the string I need based on a split index (which I think you can do in Arcade).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Sep 2021 20:59:04 GMT</pubDate>
    <dc:creator>ChrisGAEG</dc:creator>
    <dc:date>2021-09-16T20:59:04Z</dc:date>
    <item>
      <title>Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099100#M222</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a value that can be housed in 4 different columns. Not only that but the value is within a text string. Here is an example of the string -&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;1-12: ESCC02SPL01, 1-12&lt;/LI-CODE&gt;&lt;P&gt;I am trying to write an evaluation or batch calculation that searches the 4 columns for the value (contains 'SPL') and and populates a new column with the middle string (in between spaces) as the return. Such that the example above would evaluate to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ESCC02SPL01&lt;/LI-CODE&gt;&lt;P&gt;Another detail is that I need the first instance of when SPL is in the value. So if it is present in columns 3 &amp;amp; 4, I need to take the value that is in column 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I am trying to put the columns in a list and then use Find to iterate over the list. I am more of a Python person so I'm not exactly sure how to do this with Arcade. What I have so far is this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var row1 = $feature.f0;
var row2 = $feature.f0spare;
var row3 = $feature.dead
var row4 = $feature.f1

var rowlist = [row1, row2, row3, row4]

var splitter = Find('SPL', rowlist, 0)

if (splitter &amp;gt; 0) {
  return splitter
};&lt;/LI-CODE&gt;&lt;P&gt;But this is returning incorrect values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or opinions on this is greatly appreciated. Thanks for reading.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 20:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099100#M222</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-09-16T20:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099108#M223</link>
      <description>&lt;P&gt;What value is it returning for your example?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 20:39:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099108#M223</guid>
      <dc:creator>kah7_uagis</dc:creator>
      <dc:date>2021-09-16T20:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099112#M224</link>
      <description>&lt;P&gt;Instead of using a list to iterate over you could use the When() function in Arcade. This will let you test a series of conditional expressions. Then you can put your text logic as one of the returns for the expression(s).&amp;nbsp; I would also look into the Function Reference documentation for some other helpful functions to accomplish this&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/logical_functions/#when&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Custom Arcade Expression for Symbology
// Test to see if "Y" is in any of the three exceedance columns. If so,the 
// expression returns true and the point is symbololized as "Y". Otherwise, the expression
// returns false and the point is symbolized as "N". 

 
// Eceedance Fields

var exc1 =  $feature["As_1_Exc"]

 

var exc2 = $feature["As_2_Exc"]

 

var exc3 = $feature["As_3_Exc"]

 
// Testing which fields have a "Y" value and return True, else return False

var soilExceeds = When( exc1 == 'Y' || exc2 == 'Y' || exc3 == 'Y', 'Y', 'N')

 
//Return Values

return soilExceeds&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Sep 2021 21:20:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099112#M224</guid>
      <dc:creator>BHeist</dc:creator>
      <dc:date>2021-09-16T21:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099129#M225</link>
      <description>&lt;P&gt;Find returns the index # of the string you supply it, so it wasn't quite right for what I was trying to do.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 20:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099129#M225</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-09-16T20:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099136#M226</link>
      <description>&lt;P&gt;Okay I see. This is a great example, thank you. I'll just have to find the equivalent of str.contains for Arcade, then parse out the string I need based on a split index (which I think you can do in Arcade).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 20:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099136#M226</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-09-16T20:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099158#M227</link>
      <description>&lt;P&gt;Great!&lt;/P&gt;&lt;P&gt;Yes, I think you could use the Split() function in Arcade to accomplish this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Otherwise if you have a constant number of characters then maybe a Mid()function could be used to grab it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#split" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/text_functions/#split&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 21:28:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099158#M227</guid>
      <dc:creator>BHeist</dc:creator>
      <dc:date>2021-09-16T21:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099792#M229</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var values = [
  $feature.f0,
  $feature.f0spare,
  $feature.dead,
  $feature.f1
  ]
for(var v in values) {
  var value = values[v]
  if(Count(value) &amp;gt; Count(Replace(value, "SPL", ""))) {
    value = Replace(value, ":", "")
    value = Replace(value, ",", "")
    return Split(value, " ")[1]
    // you return the first found column, the next columns won't be evaluated.
  }
}
// return a default value if no column contains a value with "SPL"
return null&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Sep 2021 06:34:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1099792#M229</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-20T06:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value Across Multiple Columns</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1100306#M236</link>
      <description>&lt;P&gt;Wow this is great, thank you once again Johannes!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 14:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/extract-value-across-multiple-columns/m-p/1100306#M236</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-09-21T14:45:07Z</dc:date>
    </item>
  </channel>
</rss>

