If statements and pulldata("@layer")

731
2
Jump to solution
11-21-2022 01:14 PM
RogerAsbury
Occasional Contributor

Noticing some weird behavior and hoping someone can shed some light on it. In a survey I'm working on, a map is chosen based on a drop down menu. This is working just fine.

I'm trying to geofence where people can place a pin in those maps. When I did the first map (with no if statement) it worked great. But now that I'm trying to do it with other maps, it seems to always default to the first item in the if statement. For example, in the code below, even if I choose "map2" and click somewhere, I will get the objectid of whatever is in the location in map1. Now, if I unselect map2 and select another map and then reselect map2 without clicking in the map, it will give me the correct answer - once - the next time I click, it again shows me the objectid from map1. Any ideas?

Example code:

if(${mapchoice}="map1", pulldata("@layer", "getValueAt", "attributes.OBJECTID", "https://urltomap1/FeatureServer/1", ${location_of_problem}), 
if(${mapchoice}="map2", pulldata("@layer", "getValueAt", "attributes.OBJECTID", "https://urltomap2/FeatureServer/1", ${location_of_problem}), 
0))

 

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough
0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

I think this was posted the other day.  You need to have pulldata in separate field then call that field in the if and it seems to go better.  Give that a shot.

View solution in original post

2 Replies
DougBrowning
MVP Esteemed Contributor

I think this was posted the other day.  You need to have pulldata in separate field then call that field in the if and it seems to go better.  Give that a shot.

RogerAsbury
Occasional Contributor

Thanks much! That worked perfectly. Sorry for missing the earlier question.

--
Roger Asbury
Analyst/Programmer - Fairbanks North Star Borough