Customize Data or List Widget with Arcade

278
5
03-25-2024 08:19 AM
Labels (1)
KateDoughty1
New Contributor III

I have a table that I'd like to:

1. Color records by an attribute;

2. Concatenate one field based on value in another field.

I've been trying to do this with arcade, but I can't seem to get it to read through each table record. My latest effort is below:

var test = $feature.Land_Use
var desc = []
for (var i in $feature){
iif ($feature.Determination == 'Compatible'){
var group = test[i]
Push(desc, group)}
If ($feature.Determination == 'Incomp'){
var group = test[i]
Push(desc, group)
}}
return Concatenate(desc, ', ')

Is what I'm trying even possible with arcade or does it require a custom widget?? The reason for wanting to use list or table is so the user can search. Table is attached. Any help or suggestions is much appreciated!! TIA

 

0 Kudos
5 Replies
MFazio
by
New Contributor III

At a quick glance, I see you have an 'iif' statement which is technically an 'if-else' statement. So I believe it needs an argument to evaluate to if statement is true, and if the statement is false:

IIf(condition, trueValue, falseValue)  

0 Kudos
KateDoughty1
New Contributor III

That is correct but it still doesn't fix the issue.

0 Kudos
JeffreyThompson2
MVP Regular Contributor

Experience Builder does not currently support Arcade.

GIS Developer
City of Arlington, Texas
0 Kudos
KateDoughty1
New Contributor III

Arcade is supported in pop-ups for Experience Builder which is where I'm trying to customize the output.

0 Kudos
JeffreyThompson2
MVP Regular Contributor

I'm not sure what your intent is with this table or your Arcade script, but here is some information you may find useful.

  1. The Table Widget in Experience Builder supports searching and filtering.
  2. Arcade has if statements and the IIF function. You are mixing the syntax between the two of them causing your IIf function to break. 
  3. Calling for( i in $feature) will loop through all of the fields in a feature with a feature being a single row in your table. You should probably be using $layer or $datastore, but I'm not sure how that would be very useful in this context either.
  4. Because var test = $feature.Land_Use is outside the loop it's value will not change throughout the loop.
GIS Developer
City of Arlington, Texas
0 Kudos