I have some Arcade code that is working in test mode but then does not work in the popup or attribute table.
Test works

Popup is blank

and attribute table gives a data error

That means my code works but there is some other issue. ArcPro does not like it either.
Here is the code. I am trying to create a unique list across multiple fields and repeats from a 123 form. It is also a select multiple so the data is 1,2,3,4 etc. That makes the code pretty messy but it does work.
var sql = "SpeciesEvaluationID = '" + $feature.EvaluationID + "'";
var tbl = Filter(FeatureSetByName($map,"VegSpecies", ['*'], false), sql);
var speciesList = '';
var oneRow = [];
for (var species in tbl) {
oneRow = Split(species.RightBankNoxiousCommonName, ',')
for (var i in oneRow) {
if (!IsEmpty(oneRow[i]) && Find(oneRow[i], speciesList) == -1) {
speciesList += oneRow[i] + ', ';
}
}
oneRow = Split(species.LeftBankNoxiousCommonName, ',')
for (var i in oneRow) {
if (!IsEmpty(oneRow[i]) && Find(oneRow[i], speciesList) == -1) {
speciesList += oneRow[i] + ', ';
}
}
}
return speciesList
Open to any ideas. Thanks