I have an odd question.
In Field Maps I want to be able to click a feature and have the popup open (works fine)
I assume this would be an Arcade Expression? But can you query a FC in a popup? If I get a YES I can show a link and if it is NO then I can show the link
I hope that makes sense....
Solved! Go to Solution.
I was able to hide one or the other with this example...
Scroll down to comment by by JohannesLindner
'My code that worked for me is below
Based on == or != in an IF I created to expressions...
Then the DIV and html in the popup showed me either one or the other.
POPUP:
<tr style="background-color: rgb(255, 255, 255);" valign="top">
<td style="padding: 2px;padding-bottom: 5px;border: 1px solid rgb(203, 203, 203);padding-right: 5px;color:rgb(74, 74, 74);">Inspection Form
</td>
<td>
<div style="display:{expression/expr1};">
<a href="arcgis-survey123://?itemID= cb33fcxxxxxxx50722440146&portalUrl=https://url.gov/portal&action=edit&folder=inbox&update=true&filter=REL_GLOBALID:{GLOBALID}&callback=arcgis-fieldmaps://?itemID=1cf5c7a0xxxxxxxx2c308a2" rel="nofollow ugc" target="_blank">Inspection Form 1</a>
</div>
<div style="display:{expression/expr2};">
<a href="arcgis-survey123://?itemID= cb33fc9a378xxxxxxxxxxxx0722440146&field:REL_GLOBALID={GLOBALID}&field:GEOGRAPHICAL_LOCATION={LATITUDE},{LONGITUDE}" rel="nofollow ugc" target="_blank">Inspection Form 2<br /></a>
</div>
</td>
</tr>
EXPRESSION 1
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"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
EXPRESSION 2
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"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
It appears that I can access the WebMap from expression builder for popups ... I can see the 2nd Table in there but not sure how to access the attributes from it?
In the expression builder I can see the webmap that has the FC I am looking to query.
Here is the Table I want to query for a specific value ... if exists return true if not return false
How do I query it with Arcade Expression....
EX: If $feature.fieldValue == "something"
return True
else
return false
I think I can walk to the WebMap and Feature Class as such
var relGlobalID = ($map,"Inspection Form FC")
BUT How do I query this Feature Class in the webmap looking for a specific value in the attribute field?
the attribute field name is relGlobalID
think I found it all here... https://learn.arcgis.com/en/projects/access-attributes-from-another-layer-with-arcade/
nah still having issues...Anyone see what I am doign wrong... I think the FOR loop should be going through all the values in the "Inspection Form FC" in the webmap
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"Inspection Form FC",['REL_GLOBALID'], false)
var didIFindIt = ""
for (var i in relGlobalIDValue) {
var compareValue = i
var currentValue = globalIDValue
//return currentValue
if (currentValue == compareValue){
didIFindIt = "Found It"
}
}
return didIFindIt
OK I can do this : Based on if there is a record in the 2nd Feature Classes it returns YES or NO in the popup....
But what I want to do is show NO in Text and if YES show a link to a S123 form...
HOW do I define the below URL into a link and show that in the popup ONLY if YES
<a href="arcgis-survey123://?itemID= cb33fc9a3xxxxxxxxxxxxx40146&portalUrl=https://website.gov/portal&action=edit&folder=inbox&update=true&filter=REL_GLOBALID:..." rel="nofollow ugc" target="_blank">Inspection Form</a><br />
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"Inspection Form",['REL_GLOBALID'], false)
var status = "NO INSPECTION"
for (var i in relGlobalIDValue) {
var compareValue = Text(i.REL_GLOBALID)
var currentValue = globalIDValue
if (currentValue == compareValue){
status = "YES"
}
}
return status
I was able to hide one or the other with this example...
Scroll down to comment by by JohannesLindner
'My code that worked for me is below
Based on == or != in an IF I created to expressions...
Then the DIV and html in the popup showed me either one or the other.
POPUP:
<tr style="background-color: rgb(255, 255, 255);" valign="top">
<td style="padding: 2px;padding-bottom: 5px;border: 1px solid rgb(203, 203, 203);padding-right: 5px;color:rgb(74, 74, 74);">Inspection Form
</td>
<td>
<div style="display:{expression/expr1};">
<a href="arcgis-survey123://?itemID= cb33fcxxxxxxx50722440146&portalUrl=https://url.gov/portal&action=edit&folder=inbox&update=true&filter=REL_GLOBALID:{GLOBALID}&callback=arcgis-fieldmaps://?itemID=1cf5c7a0xxxxxxxx2c308a2" rel="nofollow ugc" target="_blank">Inspection Form 1</a>
</div>
<div style="display:{expression/expr2};">
<a href="arcgis-survey123://?itemID= cb33fc9a378xxxxxxxxxxxx0722440146&field:REL_GLOBALID={GLOBALID}&field:GEOGRAPHICAL_LOCATION={LATITUDE},{LONGITUDE}" rel="nofollow ugc" target="_blank">Inspection Form 2<br /></a>
</div>
</td>
</tr>
EXPRESSION 1
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"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
EXPRESSION 2
var globalIDValue = $feature.GLOBALID
var relGlobalIDValue = FeatureSetByName($map,"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