Hi There, I'm new to Field Maps and Arcade expressions. I have done some research and believe I should be able to write an expression to auto populate a field based on the user entry into another field. For example, if the user is collecting a point or line in a particular area which is in a field office- I should be able to auto populate the field office field with the name using some sort of select by location expression.
I could use some help with getting started on the expression...
Something like:
//if point is located in X, then Y. The Field office feature is another hosted layer in the webmap. The field I want to populate is the $feature["ADMIN_ST"] and it has domains...
Solved! Go to Solution.
Hoping one day the Google Street View hyperlink arcade expressions will work in Field Maps?... for now we just get a broken link:
Hi Jeff,
Still there is a problem in the new version of Field Maps: the ARCADE expressions defined in Web Map cannot be interpreted by Field Maps!
I am also having this issue...Field Maps V22.2.0 build 736. This has been my first attempt at creating an Arcade expression in Field Maps, so haven't seen it working in previous versions.
I was trying to create a hyperlink to a Survey123 form using Arcade, but the popup doesn't display it in Field Maps and only shows the default fields.
This is my expression:
var urlsource = 'arcgis-survey123://?itemID=';
var itemID = 'fac53b0e831d46e8a8fd8c18b0afbe5d';
var asset = UrlEncode($feature.Asset);
var asset_ID = UrlEncode($feature.Asset_Description);
var link = urlsource + itemID + "&field:asset=" + asset + "&field:asset_id=" + asset_ID;
var label = '<p><strong>Asset:</strong> ' + $feature.Asset + '<br><br><a href="' + link + '" rel="nofollow ugc noopener noreferrer" target="_blank"><strong>Add Inspection Record</strong></a></p>';
return {
type : 'text',
text : label
}
It Tests okay and produces the right result, displays as expected in AGOL Map Viewer, just not in Field Maps.
Also tried this simple example...still no joy. Any help appreciated.
return {
type : 'text',
text : 'This is a thing'
}
the popup doesn't display it in Field Maps and only shows the default fields.
Are you configuring the expression and pop-up in the newer Map Viewer? Field Maps doesn't fully support the pop-ups authored by the new Map Viewer (this is under development and planned for this fall). Can you try configuring the pop-up in Map Viewer Classic?
Thanks @Anonymous User, that makes sense. Yes, I had configured that in the new Map Viewer. I've had success doing something similar in Classic, so will just do it there. Is UrlEncode functionality (or similar) available in Map Viewer Classic for customised Pop-Ups? I'm trying to pass across to Survey123 an attribute that contains spaces and ":" characters and I don't believe that they are being parsed correctly into the URL.
You should be able to use the same UrlEncode Arcade function, as far as I know.
Yep, got it. Thanks.
For reference for others...this setup was done in Map Viewer Classic:
I also found that the url is case sensitive for the field names. I originally had "asset_id", but needed "asset_ID".