When I hard code in an array...
var array = ["2", "2"]
... right into the expression, it works.
However, when I add that same array into a field, then call that field instead within the function, it doesn't see it as an array.
$feature.array = ["2", "2"]
var array = $feature.array
Is there a way to call a string from a field and have the expression read it as a array?
Solved! Go to Solution.
Hi T L ,
When you have a feature with a field called array (probably a text field) and you edit the field to type in ["2", "2"], it will not be an array. As Joshua Bixby asked, if you would put the text "2,2" (without the quotes) in a field, you could use the Split function to split the text up and create the array:
When you click on a "2" in the result, you will see that each element is in fact a string:
What does the string from the field look like? Is it something like "2, 2"?
Hi T L ,
When you have a feature with a field called array (probably a text field) and you edit the field to type in ["2", "2"], it will not be an array. As Joshua Bixby asked, if you would put the text "2,2" (without the quotes) in a field, you could use the Split function to split the text up and create the array:
When you click on a "2" in the result, you will see that each element is in fact a string: