Select to view content in your preferred language

Arcade expression query

706
1
Jump to solution
08-06-2023 03:50 PM
TTtttTeee
Occasional Contributor

Hi Community, I am new to Arcade expression and trying to configure pop-ups for a feature layer in a web map. 

What I would like to configure is that pop-ups shows the names of point features located within the 1km distance from a selected line layer. I tried to configure this based on the example that I found in Esri community; however, it did not work for some reasons. I got an error - "Parse Error:Line 25: Unexpected end of input".  That would be much appreciated if anyone help me solve this.

Code that I used is below:

 

// create the 1km buffer
var buff = Buffer($feature, 1, 'kilometers')

// get intersecting points
var point_int = Intersects(buff, FeatureSetByName($map, 'Address_point - Residential Buildings'))

// loop through the returned points and populate an array
var address_list = []

for (var s in point_int) {
    // get distance
    var dist = Distance(s, $feature, 'kilometers')

    // push a formatted string to the address_list array
    Push(address_list, `${s['Incident Name']}: ${Text(dist, '#,###.0')} km away`)

// return a newline-delimited string from the array
return Concatenate(address_list, '\n')

 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

You haven't closed your for loop. Add a closing curly brace in line 16.

Also, in line 15 your field name has a space. Use the actual field name, not the alias.


Have a great day!
Johannes

View solution in original post

1 Reply
JohannesLindner
MVP Frequent Contributor

You haven't closed your for loop. Add a closing curly brace in line 16.

Also, in line 15 your field name has a space. Use the actual field name, not the alias.


Have a great day!
Johannes