I saw a post similar to this about using the decode expression to populate a popup on AGOL. I have a little twist. I want the decode expression to select a different record depending on the value of a certain attribute and then return that record's attribute values.
So what I want to get is a line in the popup that says Secondary Contact and fills in the inspector name and phone number by the Decode determining which ID or OBJECTID record to use from the INSP_AREA of the polygon selected.
Within the record being selected by the ID or OBJECTID field to return the Inspector Name and Phone Number.
I'm a bit of a novice so not sure what I'm doing wrong.
I tried a few iterations of this and got to: Error on line 11. Cannot assign to const value.
var north = 1;
var alt_north = 3;
var south = 2;
var alt_south = 322;
var selection = $feature.INSP_AREA;
var row=Decode(selection, "Northwest", north, "Northeast", north, "Hospital", alt_north, "Power Plant", alt_north, "Airport", alt_south, south);
var contact = "Secondary Contact " + $feature.INSPECTOR_NAME + " phone " + $feature.PHONE;
return When(row < 3, ($feature.ID = row; contact), row >= 3,($feature.OBJECTID = row; contact), "Sorry");
And I tried this: Error on line 11. Cannot assign to const value.
var north = 1;
var alt_north = 3;
var south = 2;
var alt_south = 322;
var selection = $feature.INSP_AREA;
var row=Decode(selection, 'Northwest', north, 'Northeast', north, 'Hospital', alt_north, 'Power Plant', alt_north, 'Airport', alt_south, south);
var contact = "Secondary Contact " + $feature.INSPECTOR_NAME + " phone " + $feature.PHONE;
iif(row < 3, $feature.ID = row, $feature.OBJECTID = row);
return "Secondary Contact " + $feature.INSPECTOR_NAME + " phone " + $feature.PHONE;
