<?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 Arcade: multiple values in an array (arrays in an array). in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-multiple-values-in-an-array-arrays-in-an/m-p/1025936#M5765</link>
    <description>&lt;P&gt;This script adds a number of rows to a table on insert of another table.&amp;nbsp; It uses an array to updated a field value when these rows are entered.&amp;nbsp; I would like to enter multiple field values instead of just one, which works as seen below.&amp;nbsp; My first script is what works with one value, using a simple array.&amp;nbsp; My second script is what I am trying to accomplish but I am not sure how to format my row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var rowid = $feature.uniquerowid
var myArray = ['value1','value2','value3']
var counter = 0
if(IsEmpty($feature.inspect_date)){
for (var os in myArray){
myArray[counter] = 
                     {
       "attributes": {
             "parentrowid": rowid,
             "q_2control": myArray[os],
             "number": counter
                            }
                        }
                        counter++
                        }
   return {
"result": rowid,
"edit": [{
    "className": "featureClass",
    "adds": myArray
              }]
           }

}
else {
return rowid
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to enter multiple fields for each row added.&amp;nbsp; Something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var rowid = $feature.uniquerowid
var myArray = [['value1A,'value1B'],['value2A,'value2B'],['value3A,'value3B']]
var counter = 0
if(IsEmpty($feature.inspect_date)){
for (var os in myArray){
myArray[counter] = 
                     {
       "attributes": {
             "parentrowid": rowid,
             "q_2control": myArray[os[a]],
             "choice": myArray[os[b]]
             "number": counter
      
                            }
                        }
                        counter++
                        }
   return {
"result": rowid,
"edit": [{
    "className": "featureClass",
    "adds": myArray
              }]
           }

}
else {
return rowid
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see above in my add statement I am updating two fields on each row...or trying to.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 16:38:52 GMT</pubDate>
    <dc:creator>TL2</dc:creator>
    <dc:date>2021-02-11T16:38:52Z</dc:date>
    <item>
      <title>Arcade: multiple values in an array (arrays in an array).</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-multiple-values-in-an-array-arrays-in-an/m-p/1025936#M5765</link>
      <description>&lt;P&gt;This script adds a number of rows to a table on insert of another table.&amp;nbsp; It uses an array to updated a field value when these rows are entered.&amp;nbsp; I would like to enter multiple field values instead of just one, which works as seen below.&amp;nbsp; My first script is what works with one value, using a simple array.&amp;nbsp; My second script is what I am trying to accomplish but I am not sure how to format my row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var rowid = $feature.uniquerowid
var myArray = ['value1','value2','value3']
var counter = 0
if(IsEmpty($feature.inspect_date)){
for (var os in myArray){
myArray[counter] = 
                     {
       "attributes": {
             "parentrowid": rowid,
             "q_2control": myArray[os],
             "number": counter
                            }
                        }
                        counter++
                        }
   return {
"result": rowid,
"edit": [{
    "className": "featureClass",
    "adds": myArray
              }]
           }

}
else {
return rowid
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to enter multiple fields for each row added.&amp;nbsp; Something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var rowid = $feature.uniquerowid
var myArray = [['value1A,'value1B'],['value2A,'value2B'],['value3A,'value3B']]
var counter = 0
if(IsEmpty($feature.inspect_date)){
for (var os in myArray){
myArray[counter] = 
                     {
       "attributes": {
             "parentrowid": rowid,
             "q_2control": myArray[os[a]],
             "choice": myArray[os[b]]
             "number": counter
      
                            }
                        }
                        counter++
                        }
   return {
"result": rowid,
"edit": [{
    "className": "featureClass",
    "adds": myArray
              }]
           }

}
else {
return rowid
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see above in my add statement I am updating two fields on each row...or trying to.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 16:38:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-multiple-values-in-an-array-arrays-in-an/m-p/1025936#M5765</guid>
      <dc:creator>TL2</dc:creator>
      <dc:date>2021-02-11T16:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: multiple values in an array (arrays in an array).</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-multiple-values-in-an-array-arrays-in-an/m-p/1026247#M5766</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/371835"&gt;@TL2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Since you don't have a variable a and b, the code will fail. You can use the indexes (0 and 1) to extract the "a" and "b" values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;             "q_2control": myArray[os][0],
             "choice": myArray[os][1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 13:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-multiple-values-in-an-array-arrays-in-an/m-p/1026247#M5766</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-12T13:33:24Z</dc:date>
    </item>
  </channel>
</rss>

