Select to view content in your preferred language

Calculate field based on filtered points layer

23
0
yesterday
RileyScanlan
Emerging Contributor

Hi there,


I am trying to pull a text field from a points layer that meets two filter criteria. I have a very similar calculation that works in another field but can't get this to work. I think it's something related to trying to pull one value from a whole featureset? But not sure what the solution is.

Thanks in advance!

 

// set the point feature layer as a variable
var tree = FeatureSetById($map, "18d5b66cd4a-layer-17")


var filter_by_grid = "'" + $feature["GRID_ID"] + "'"

var filter_by_year = "'" + $feature.PROJECT_YEAR + "'"


// the filter expression
var filter_expression_grid = "GRID_ID = " + filter_by_grid

var filter_expression_year = "PROJECT = " + filter_by_year

// filter the the points to only this block
var filtered_grid = filter(tree, filter_expression_grid)

var filtered_year = filter(filtered_grid, filter_expression_year)


//var trees = First(filtered_year)
var trees = First(filtered_year)
return trees.Re_Entry
0 Kudos
0 Replies