Labels not displaying on point layer with certain Display filters

205
3
02-03-2021 11:40 AM
AGMAD
by
New Contributor II

I am having an issue labeling a point feature I have on a web map that is being used for ArcGIS Field Maps on Ipads. 

The Layer being labeled called, PointTreatment, has data from 2020 and will have data from 2021 added throughout the year. I have this arcade expression used to label the feature:

/// last updated Feb 3 2021
/// added code for labeling treatments in 2020
/// labeling for days old treatment, sample
/// set up variables

var Acres = $feature.Acres
var LBS = $feature.AmountUsed
var Product = DomainName($feature,"Product") + ', '
/// if else statements
if($feature.Date == today()){
var age =' today';
}
else if(Year($feature.Date) == 2020){
var age = ' 2020'
}
else var age = text(round(datediff(now(), $feature.Date, 'days'),0) + ' days ago on ' + text(date($feature.date),'ddd, ' + 'MMM ' + 'D'));

/// 2020 labels
if( age == ' 2020' && isEmpty($feature.AmountUsed)){
var status = 'Sample taken ' + Text(Date($feature.Date), 'MMM') + ' 2020'
}
else if( age == ' 2020'){
var status = Acres + ' acres in ' + Text(Date($feature.Date), 'MMM') + ' 2020'
}
/// New Labels
else if($feature.Product == 'Natular G (EPA#8329-80)' && (datediff(now(), $feature.Date, 'days'))<14){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Vectobac GR (EPA#73049-486)' && (datediff(now(), $feature.Date, 'days'))<14){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Vectobac 12AS (EPA#73049-38)' && (datediff(now(), $feature.Date, 'days'))<14){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Kontrol Oil (EPA#73748-10)' && (datediff(now(), $feature.Date, 'days'))<7){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Abate 1% (EPA#8329-17)' && (datediff(now(), $feature.Date, 'days'))<14){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'VectoMax FG (EPA#73049-429)' && (datediff(now(), $feature.Date, 'days'))<29){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Duplex G (EPA#89459-93)' && (datediff(now(), $feature.Date, 'days'))<33){
var status = LBS + ' LBS of ' + Product + age;
}
else if($feature.Product == 'Natular G30 (EPA#8329-83)' && (datediff(now(), $feature.Date, 'days'))<34){
var status = LBS + ' LBS of ' + Product + age;
}


/// must include final else statement, or it will trigger a runtime error for var status
else{
var status = ''
}
return status

After I add this expression everything labels perfectly and looks like this...

AB53D837-1409-40AC-B0DC-F714FCE9B7FB.png

 

My next step is adding a filter that will only display data that is dated this year or march of the previous year. here is a screencap of the filter....

Untitled.png

 

After that filter is added the labeling on Field Maps and Collector disappears but it does not disappear on the AGOL Web Map. 

here are screencaps from fieldmaps with the labeling gone after applying the filter..

2B0D915D-8EF4-445B-BCDA-42BB4172023C.png

 

and screencap from agol with the labeling still displaying after applying the filter...

Untitled2.png

 

does anyone know why this is happening?

I feel like it is a bug on the esri's end, but if anyone has any tips let me know. Thanks.

0 Kudos
3 Replies
AGMAD
by
New Contributor II

Update...

adding 2 expressions to the filter removes the labels in the mobile app no matter what the expressions are.

0 Kudos
AGMAD
by
New Contributor II

Update...

Also no matter what the label expression is the filter removes the labels

0 Kudos
AlixPower
Esri Contributor

Hi @AGMAD,

Sorry that you are having this issue. Do you see the same issue on ArcGIS Online in Web Map Viewer Beta?

Alix

0 Kudos