When constructing a list in a python script, it's easy to accommodate long entries to make them readable by splitting them into several lines:
myList = ['blahblah0', 'blahblah1', 'blahblah2',
'blahblah3', 'blahblah4', 'blahblah5']
However, the same does not hold true in arcade. I have to construct a list of attributes that goes on ad nauseam for an attribute rule . Adding attribute field names in an arcade list that goes on seemingly forever is tedious at best. Is there a way to manage a list such that arcade can be happy with it and I don't go blind? Can I merge a series of lists together in arcade? That way I could have multiple lists each of a readable size, and merge them into one 'one the fly' so arcade can read each of the attributes?
Solved! Go to Solution.
Hi Joe Borgione ,
In Arcade you can also split long lists over multiple lines:
var myList = ['blahblah0', 'blahblah1', 'blahblah2',
'blahblah3', 'blahblah4', 'blahblah5'];
To combine multiple list you don't have the easy sum of the lists as you have in Python but you can do this:
var lst1 = ['blahblah0', 'blahblah1', 'blahblah2'];
var lst2 = ['blahblah3', 'blahblah4', 'blahblah5'];
var lst = lst1;
for (var i in lst2) {
lst[Count(lst)] = lst2[i];
}
return lst;
...or even this (which will not work for lists with numeric data):
var lst1 = ['blahblah0', 'blahblah1', 'blahblah2'];
var lst2 = ['blahblah3', 'blahblah4', 'blahblah5'];
var lst = Split(Concatenate(lst1, "#") + "#" + Concatenate(lst2, "#"), "#");
return lst;
Hi Joe Borgione ,
In Arcade you can also split long lists over multiple lines:
var myList = ['blahblah0', 'blahblah1', 'blahblah2',
'blahblah3', 'blahblah4', 'blahblah5'];
To combine multiple list you don't have the easy sum of the lists as you have in Python but you can do this:
var lst1 = ['blahblah0', 'blahblah1', 'blahblah2'];
var lst2 = ['blahblah3', 'blahblah4', 'blahblah5'];
var lst = lst1;
for (var i in lst2) {
lst[Count(lst)] = lst2[i];
}
return lst;
...or even this (which will not work for lists with numeric data):
var lst1 = ['blahblah0', 'blahblah1', 'blahblah2'];
var lst2 = ['blahblah3', 'blahblah4', 'blahblah5'];
var lst = Split(Concatenate(lst1, "#") + "#" + Concatenate(lst2, "#"), "#");
return lst;
So all it takes is a semi colon and I'm good to go? Awesome! Thanks Xander Bakkerr!
Hi jborgion
I don't think the semicolon is required. The "var " at the beginning is.