I have a pretty loaded question....
I have a webmap that has a custom popup with a couple expressions.
If there is a related record in a FC then the Update Expression Link is displayed
If there is NO related record in a FC then the Add Expression link is displayed.
<div style="display:{expression/expr0};"><a href="arcgis-survey123://?itemID=4ebxxfd0f0xx284304e518&portalUrl=https://xxx.gov/portalx&action=edit&folder=inbox&update=true&filter=REL_GLOBALID:{GLOBALID}&callback=arcgis-fieldmaps://?itemID=7b9ba6cedxxx6e8dc5cec1d65" rel="nofollow ugc" target="_blank">Update OA-13 Inspection Form</a>
</div>
<div style="display:{expression/expr1};"><a href="arcgis-survey123://?itemID=4ebfdffxxx279284304e518&field:REL_GLOBALID={GLOBALID}&field:GEOGRAPHICAL_LOCATION={LATITUDE},{LONGITUDE}&callback=arcgis-fieldmaps://?itemID=7b9ba6ced6bxxxdc5cec1d65" rel="nofollow ugc" target="_blank">Add OA-13 Inspection Form</a>
Update Expression:
// THIS SHOWS THE LINK IF THERE IS AN EXISTING RECORD
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"Update - OA 13 Inspection Form",['REL_GLOBALID'], false)
var status = "none"
for (var i in relGlobalIDValue) {
var compareValue = Text(i.REL_GLOBALID)
var currentValue = globalIDValue
if (currentValue == compareValue){
status = "inline"
}
}
return status
Add Expression
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"Add OA 13 Inspection Form",['REL_GLOBALID'], false)
//var status = "NO INSPECTION"
var status = "inline"
for (var i in relGlobalIDValue) {
var compareValue = Text(i.REL_GLOBALID)
var currentValue = globalIDValue
if (currentValue == compareValue){
status = "none"
}
}
return status
This works GREAT and can be clearly seen in the Popup below... where only one of them is shown at a time...In this case there is a related record for this Feature and as such it says Update for the second link "Update OA-13 Inspection Form"
If there was NOT a related record it would say "Add OA-13 Inspection Record"
So everything is working Fantastic up to this point... But I then create a Web application and then add the Query Widget.
=============================================
I configure the Query widget to " Use layer's pop-up configuration in the web map"
Is does this to a certain degree BUT the Expression is not read properly and ALWAYS displays BOTH of the links created via expressions..(See 2nd image below)
No matter what I do I cannot get the QUERY WIDGET to respect the Expressions in the WebMap Custom Config as specified int he Query Widget Config Settings.
THOUGHTS?
Solved! Go to Solution.
FROM ESRI SUPPORT:
I appreciate you sharing the post and providing an excellent details! I understood you have a custom expression which works as expected in Map Viewer but when you create a web app builder using this map, the query widget in web app builder is not honoring this expression.
I went ahead and did some research and found that pop-up configurations made in ArcGIS Online Map Viewer are not compatible with ArcGIS Web AppBuilder. Furthermore, unfortunately, the behavior you are experiencing, looking at your post, seems to be a BUG-000108767: "The Web AppBuilder for ArcGIS Query widget's pop-up does not honor the pop-up configuration of the related table assigned in the ArcGIS Online web map". I can go ahead and attach this bug to our case and you can monitor the status of this bug.
Maybe something I have to get with ESRI about?
FROM ESRI SUPPORT:
I appreciate you sharing the post and providing an excellent details! I understood you have a custom expression which works as expected in Map Viewer but when you create a web app builder using this map, the query widget in web app builder is not honoring this expression.
I went ahead and did some research and found that pop-up configurations made in ArcGIS Online Map Viewer are not compatible with ArcGIS Web AppBuilder. Furthermore, unfortunately, the behavior you are experiencing, looking at your post, seems to be a BUG-000108767: "The Web AppBuilder for ArcGIS Query widget's pop-up does not honor the pop-up configuration of the related table assigned in the ArcGIS Online web map". I can go ahead and attach this bug to our case and you can monitor the status of this bug.