Yes I too am constantly doing stuff like this in the webmap to return info to the popup because I work for county government and everyone wants to know what their property intersects:
var intParcel = Intersects(FeatureSetByName($map,"Active Petition", ['petitiontype', 'petitionid'], false),Buffer($feature, -10, 'feet'));
var plist = '';
var pFirst= First(IntParcel);
function GetInitDomainDct() {
var dom = Domain(intParcel, "petitiontype");
var cvs = dom["codedValues"];
var dct = {};
for (var i in cvs) {
I kind of get around the +/- in
var cv = cvs[i];
dct[cv["code"]] = cv["name"];
}
return dct;
}
var rt = GetInitDomainDct();
if (!IsEmpty(pFirst)){
for (var k in intParcel)
{
plist += rt[k.petitiontype] + ' ' + k.petitionid + TextFormatting.NewLine;
}
} else {
plist = 'This parcel is not part of any current petition(s).';
}
return plist;
I kind of get around the +/- inaccuracies in our parcel lines by adding the negative buffer, but what I really need is to set up a case (or a when or an if) that is scale dependent, and won't run the intersects at small scales, beyond say 1:36K or 1:18.
But I'm not sure where to get at the scale parameter when using the map profile. If I knew where to get at that, I'd be more than willing to run some tests on my expressions and see what comes back...