Hi there,
I am trying to edit my attribute rule to remove the ';' that is produced at the start of my result.
I am attempting to ensure that whenever a new Project A polygon is created, that the project_number field for any intersecting polygons from Project B is populated for the project_number field in Project A. This includes when multiple projects from Project B are intersecting with Project A. It works with the logic, but the output produces a ; at the beginning of the output.
The attribute rule I've applied to my Projects_A class is producing an output like the below:
Projects: ; PP-2023-1234; PP-2023-2345
--
var projB = Intersects(FeatureSetByName($datastore, 'Projects_B', ['project_number']), $feature)
var proj_nums
for (var projB_row in projB) {
proj_nums = proj_nums + ';' + ' ' + projB_row.project_number
}
return proj_nums
Is there a way to alter the above to ensure that the ; is removed from the resulting output start, and only in the middle to separate multiple project_numbers?
Solved! Go to Solution.
Try using an array to collect your values and then use Concatenate
var proj_nums = []
for (var projB_row in projB) {
Push(proj_nums, projB_row.project_number)
}
return Concatenate(proj_nums, "; ")
Try using an array to collect your values and then use Concatenate
var proj_nums = []
for (var projB_row in projB) {
Push(proj_nums, projB_row.project_number)
}
return Concatenate(proj_nums, "; ")
Thanks so much @TedHoward2 - that worked perfectly!