<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Labels not displaying in Map Viewer although Arcade expression tests successfully in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324869#M54333</link>
    <description>&lt;P&gt;In ArcGIS Portal an Arcade labeling expression is testing successfully in the Arcade editor (returns expected value in the Results tab), but the feature in the Map Viewer/Visualization does not display.&amp;nbsp; All features in this layer remain unlabeled.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-09-01_10-43-42.jpg" style="width: 730px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79686i29D295118EA235F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-09-01_10-43-42.jpg" alt="2023-09-01_10-43-42.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-09-01_10-49-01.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79687i9B43CA65B962BD68/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-09-01_10-49-01.jpg" alt="2023-09-01_10-49-01.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full arcade expression is below.&amp;nbsp; This same expression works within ArcGIS Pro (features are labeled) .&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;////////////////////////////////////////
// label order: 1-MaxFeatID if joined, 2-IDPK if not joined, 3-MaximoID (if Metro returns last 5 chars with prefix "*" or "HYD" if hydrant/hyd valve, if not Metro returns full MaxID), 4-FeatureName
//////////
var commodity = 'water'
var assettype = 'hydrant'

var field_typeassetnum = assettype + '_assetnum'
var field_typefeatid = assettype + '_featureid'
var field_locations = 'locations_location'
var field_nodeidpk = commodity + 'utilitynodeidpk'
var field_featureidpk = commodity + 'utilityfeatureidpk'
var field_max = 'maximoassetidfk'
var field_maxloc = 'maximolocationidfk'

var feat_text = Text($feature)
var portal_tf = when(Find('editor', feat_text) != -1, True, False)
Console('portal_tf: '+portal_tf)

if(portal_tf == False){
    Expects($feature, 'maximoassetidfk', 'waterutilitynodeidpk', 'waterutilityfeatureidpk', 'locations_location', 'maximolocationidfk', 'capbank_assetnum', 'condcltr_assetnum', 'ctrlvalve_assetnum', 'dynprotdev_assetnum', 'electmeter_assetnum', 'encl_assetnum', 'expjoint_assetnum', 'generator_assetnum', 'gtows_assetnum', 'hydrant_assetnum', 'inst_assetnum', 'line_assetnum', 'mechmeter_assetnum', 'motor_assetnum', 'pipe_assetnum', 'pump_assetnum', 'receptacle_assetnum', 'relvalve_assetnum', 'shorepwr_assetnum', 'statprodev_assetnum', 'supstructure_assetnum', 'surfstructure_assetnum', 'switch_assetnum', 'sysvalve_assetnum', 'tank_assetnum', 'ugstructure_assetnum', 'voltreg_assetnum', 'well_assetnum', 'xfmr_assetnum', 'capbank_featureid', 'condcltr_featureid', 'ctrlvalve_featureid', 'dynprotdev_featureid', 'electmeter_featureid', 'encl_featureid', 'expjoint_featureid', 'generator_featureid', 'gtows_featureid', 'hydrant_featureid', 'inst_featureid', 'line_featureid', 'mechmeter_featureid', 'motor_featureid', 'pipe_featureid', 'pump_featureid', 'receptacle_featureid', 'relvalve_featureid', 'shorepwr_featureid', 'statprodev_featureid', 'supstructure_featureid', 'surfstructure_featureid', 'switch_featureid', 'sysvalve_featureid', 'tank_featureid', 'ugstructure_featureid', 'voltreg_featureid', 'well_featureid', 'xfmr_featureid')
}

Console(Text($feature))

var idpk = When(Haskey($feature, field_nodeidpk), $feature[field_nodeidpk], Haskey($feature, field_featureidpk), $feature[field_featureidpk], '')
var typeassetnum = When(Haskey($feature, field_typeassetnum), $feature[field_typeassetnum], Haskey($feature, field_maxloc), $feature[field_maxloc], '')
var typefeatid = When(Haskey($feature, field_typefeatid), $feature[field_typefeatid], Haskey($feature, field_locations), $feature[field_locations], '')
var maxid = When(Haskey($feature, field_max), $feature[field_max], '')

Console(iif(Haskey($feature, field_nodeidpk)||Haskey($feature, field_featureidpk), 'haskey - idpk', 'DOES NOT haskey - idpk'))
Console(iif(Haskey($feature, field_typeassetnum)||Haskey($feature, field_maxloc), 'haskey - typeassetnum or maxloc', 'DOES NOT haskey - typeassetnum or maxloc'))
Console(iif(Haskey($feature, field_typefeatid)||Haskey($feature, field_locations), 'haskey - typefeatid or locations', 'DOES NOT haskey - typefeatid or locations'))
Console(iif(Haskey($feature, field_max), 'haskey - maxid', 'DOES NOT haskey - maxid'))

// //
// if(Haskey($feature, field_max)){
//     Console('haskey - maxid')
//     var maxid = $feature[field_max]
// }
// else
// {
//     Console('DOES NOT haskey - maxid')
//     var maxid = ''
// }
// //////////

var site = $feature.installationid 
var fn = $feature.featurename 

// QC variables
site = when(!IsEmpty(site), Trim(site), '')
idpk = when(!IsEmpty(idpk), Trim(idpk), '') 
maxid = when(!IsEmpty(maxid), Trim(maxid), '') 
fn = when(!IsEmpty(fn), Trim(fn), '') 
typeassetnum = when(!IsEmpty(typeassetnum), Trim(typeassetnum), '') 
typefeatid = when(!IsEmpty(typefeatid), Trim(typefeatid), '') 

// display variables (QC labeling)
//return('site:'+site+'\nfn:'+fn+'\ntypeassetnum:'+typeassetnum+'\ntypefeatid:'+typefeatid+'\nidpk:'+idpk+'\nmaxid:'+maxid)

// metro=NBPL, NBC, NBSD, NAFEC 
var uic = when(Count(site) &amp;gt; 5, Left(site, 6), site) 
var metro = ['N63406', 'N00246', 'N00245', 'N60042'] 
var metro_tf = Boolean(IndexOf(metro, uic)+1) 

var badvals = ['ABANDONED', 'Vault', 'Hand Hole', 'Junction Box', 'Pull Box', 'Handhole', 'Manhole', 'New', 'NEW', 'NA', 'Null', 'unk', 'Unk', 'UNK', 'Unknown', 'UNKNOWN', '99999', 'Awaiting Maximo Record', 'TBD', 'LEMOOR-U89', 'Airfield Light', 'DropInlet', '068111M', '088111M', 'PORHUE-U73', 'POIMUG-S31', 'POIMUG-S5', 'CHILAK-S72', 'LEMOOR-U13', '32052', 'Parking Lot Light', 'Street Light', '280060', '2-07516SL', 'Security Light', 'BASNI27 TAXI LIGHT', 'LEMOOR-U80', 'CurbInlet', 'CHILAK-S12', 'Private', '200753', 'UMA254000224', '2-08301PL', '068111MAREA12', 'CatchBasin', 'R84714', 'Unk', 'R126016', 'CurbCut', 'BASNIS17  LIGHTING', 'R84642', '200534', '066311MAREA01', 'R56663', 'R72084', 'R126248', 'CHILAK-S14', '068111MAREA02', '068111MPIER07', 'UMA254000222', 'R126084', 'R84709', '068111MPIER13', '068111MPIER02', 'CHILAK-41252', '068111MPIER03', '068111MPIER04', 'R126242', '068111MPIER08', 'R116581', '068111MPIER05', '068111MPIER10', 'Traffic Light', 'R146796', '068111MPIER12', '086311MAREA01', 'POIMUG-200327', 'R84691', 'LTG-SEC', 'R126507', 'R126514', 'R84673', 'NBC-N-12', 'UMA254000226', 'IID', '068111MPIER01', '068111MPIER06', 'NBSD-PW-SA-PR10', '118311MAREA03', 'Asset creation required', 'R84695', '289062', '118311MAREA02', '118311MAREA01', 'R126177', 'Riser', 'R116524', 'R126520', 'Walkway Light', '0', 'CHILAK-U19', '086311MAREA06', 'R83758', 'R84677', 'Recreation Field Light', 'R126189', 'PipeInlet', '&amp;lt;Null&amp;gt;', 'NOT IN MAXIMO', 'UMA339000429', 'UMA260000011', 'R143822', '086311MAREA06-SDG&amp;amp;E', 'POIMUG-SS', 'UMA254000225', '025128STAC-01', 'Abn', 'No', 'R126178', 'R126183', 'R126190', '086311MAREA07', 'CHILAK-02755', 'R116520', 'R45432', '086311MAREA05', 'Asset creation needed', 'NASSCO', 'NEEDNEW_WASDUPE', 'location needed', 'N/A', 'UNKNOWN', 'BoxInlet', 'Other', '+', 'WELL'] 

idpk = when(Boolean(IndexOf(badvals, idpk)+1), '', idpk) 
maxid = when(Boolean(IndexOf(badvals, maxid)+1), '', maxid) 
fn = when(Boolean(IndexOf(badvals, fn)+1), '', fn) 

fn = when(Count(fn) &amp;gt; 20, trim(Right(fn, 20)), fn) 

if (metro_tf == True) 
    { 
    var maxidvalid = when(!IsEmpty(typeassetnum), True, False) 
    var typefeatidvalid = when(!IsEmpty(typefeatid) &amp;amp;&amp;amp; maxid != typefeatid, True, False) 
    idpk = when(maxidvalid == True &amp;amp;&amp;amp; typefeatidvalid == True, typefeatid, idpk) 
    var hyd = when(Find('HYD', maxid) != -1, True, False) 
    if (hyd == True) 
        { 
        var hydptct = when(hyd == True, Count(Split(maxid, 'HYD')), 0) 
        var hydpt1 = when(hyd == True &amp;amp;&amp;amp; hydptct == 2, trim(Split(maxid, 'HYD')[0]), '') 
        var hydpt2 = when(hyd == True &amp;amp;&amp;amp; hydptct == 2, trim(Split(maxid, 'HYD')[1]), '') 
        maxid = when(hydptct == 2 &amp;amp;&amp;amp; hydpt2 != '', Concatenate(['HYD', hydpt2]), 
                 hydptct == 2 &amp;amp;&amp;amp; hydpt2 == '', maxid, 
                     maxid 
                 )    
        } 
    else 
        {maxid = when(Count(maxid) &amp;gt;= 5, "*"+trim(Right(maxid, 5)), maxid)}  
    Console(when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, ''))
    return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, '') 
   } 

   if (metro_tf == False) 
   { 
   var maxidvalid = when(!IsEmpty(typeassetnum), True, False) 
   var typefeatidvalid = when(!IsEmpty(typefeatid), True, False) 
   idpk = when(maxidvalid == True &amp;amp;&amp;amp; typefeatidvalid == True, typefeatid, idpk) 
   //return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, '') 
   Console(when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(maxid), maxid, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(maxid) &amp;amp;&amp;amp; !IsEmpty(fn), fn, ''))
   return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(maxid), maxid, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(maxid) &amp;amp;&amp;amp; !IsEmpty(fn), fn, '') 
  } &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Console() output in the messages tab, which mirror the Return statements, also shows the correct label value.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2023 18:03:49 GMT</pubDate>
    <dc:creator>JPrescott</dc:creator>
    <dc:date>2023-09-01T18:03:49Z</dc:date>
    <item>
      <title>Labels not displaying in Map Viewer although Arcade expression tests successfully</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324869#M54333</link>
      <description>&lt;P&gt;In ArcGIS Portal an Arcade labeling expression is testing successfully in the Arcade editor (returns expected value in the Results tab), but the feature in the Map Viewer/Visualization does not display.&amp;nbsp; All features in this layer remain unlabeled.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-09-01_10-43-42.jpg" style="width: 730px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79686i29D295118EA235F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-09-01_10-43-42.jpg" alt="2023-09-01_10-43-42.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-09-01_10-49-01.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79687i9B43CA65B962BD68/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-09-01_10-49-01.jpg" alt="2023-09-01_10-49-01.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full arcade expression is below.&amp;nbsp; This same expression works within ArcGIS Pro (features are labeled) .&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;////////////////////////////////////////
// label order: 1-MaxFeatID if joined, 2-IDPK if not joined, 3-MaximoID (if Metro returns last 5 chars with prefix "*" or "HYD" if hydrant/hyd valve, if not Metro returns full MaxID), 4-FeatureName
//////////
var commodity = 'water'
var assettype = 'hydrant'

var field_typeassetnum = assettype + '_assetnum'
var field_typefeatid = assettype + '_featureid'
var field_locations = 'locations_location'
var field_nodeidpk = commodity + 'utilitynodeidpk'
var field_featureidpk = commodity + 'utilityfeatureidpk'
var field_max = 'maximoassetidfk'
var field_maxloc = 'maximolocationidfk'

var feat_text = Text($feature)
var portal_tf = when(Find('editor', feat_text) != -1, True, False)
Console('portal_tf: '+portal_tf)

if(portal_tf == False){
    Expects($feature, 'maximoassetidfk', 'waterutilitynodeidpk', 'waterutilityfeatureidpk', 'locations_location', 'maximolocationidfk', 'capbank_assetnum', 'condcltr_assetnum', 'ctrlvalve_assetnum', 'dynprotdev_assetnum', 'electmeter_assetnum', 'encl_assetnum', 'expjoint_assetnum', 'generator_assetnum', 'gtows_assetnum', 'hydrant_assetnum', 'inst_assetnum', 'line_assetnum', 'mechmeter_assetnum', 'motor_assetnum', 'pipe_assetnum', 'pump_assetnum', 'receptacle_assetnum', 'relvalve_assetnum', 'shorepwr_assetnum', 'statprodev_assetnum', 'supstructure_assetnum', 'surfstructure_assetnum', 'switch_assetnum', 'sysvalve_assetnum', 'tank_assetnum', 'ugstructure_assetnum', 'voltreg_assetnum', 'well_assetnum', 'xfmr_assetnum', 'capbank_featureid', 'condcltr_featureid', 'ctrlvalve_featureid', 'dynprotdev_featureid', 'electmeter_featureid', 'encl_featureid', 'expjoint_featureid', 'generator_featureid', 'gtows_featureid', 'hydrant_featureid', 'inst_featureid', 'line_featureid', 'mechmeter_featureid', 'motor_featureid', 'pipe_featureid', 'pump_featureid', 'receptacle_featureid', 'relvalve_featureid', 'shorepwr_featureid', 'statprodev_featureid', 'supstructure_featureid', 'surfstructure_featureid', 'switch_featureid', 'sysvalve_featureid', 'tank_featureid', 'ugstructure_featureid', 'voltreg_featureid', 'well_featureid', 'xfmr_featureid')
}

Console(Text($feature))

var idpk = When(Haskey($feature, field_nodeidpk), $feature[field_nodeidpk], Haskey($feature, field_featureidpk), $feature[field_featureidpk], '')
var typeassetnum = When(Haskey($feature, field_typeassetnum), $feature[field_typeassetnum], Haskey($feature, field_maxloc), $feature[field_maxloc], '')
var typefeatid = When(Haskey($feature, field_typefeatid), $feature[field_typefeatid], Haskey($feature, field_locations), $feature[field_locations], '')
var maxid = When(Haskey($feature, field_max), $feature[field_max], '')

Console(iif(Haskey($feature, field_nodeidpk)||Haskey($feature, field_featureidpk), 'haskey - idpk', 'DOES NOT haskey - idpk'))
Console(iif(Haskey($feature, field_typeassetnum)||Haskey($feature, field_maxloc), 'haskey - typeassetnum or maxloc', 'DOES NOT haskey - typeassetnum or maxloc'))
Console(iif(Haskey($feature, field_typefeatid)||Haskey($feature, field_locations), 'haskey - typefeatid or locations', 'DOES NOT haskey - typefeatid or locations'))
Console(iif(Haskey($feature, field_max), 'haskey - maxid', 'DOES NOT haskey - maxid'))

// //
// if(Haskey($feature, field_max)){
//     Console('haskey - maxid')
//     var maxid = $feature[field_max]
// }
// else
// {
//     Console('DOES NOT haskey - maxid')
//     var maxid = ''
// }
// //////////

var site = $feature.installationid 
var fn = $feature.featurename 

// QC variables
site = when(!IsEmpty(site), Trim(site), '')
idpk = when(!IsEmpty(idpk), Trim(idpk), '') 
maxid = when(!IsEmpty(maxid), Trim(maxid), '') 
fn = when(!IsEmpty(fn), Trim(fn), '') 
typeassetnum = when(!IsEmpty(typeassetnum), Trim(typeassetnum), '') 
typefeatid = when(!IsEmpty(typefeatid), Trim(typefeatid), '') 

// display variables (QC labeling)
//return('site:'+site+'\nfn:'+fn+'\ntypeassetnum:'+typeassetnum+'\ntypefeatid:'+typefeatid+'\nidpk:'+idpk+'\nmaxid:'+maxid)

// metro=NBPL, NBC, NBSD, NAFEC 
var uic = when(Count(site) &amp;gt; 5, Left(site, 6), site) 
var metro = ['N63406', 'N00246', 'N00245', 'N60042'] 
var metro_tf = Boolean(IndexOf(metro, uic)+1) 

var badvals = ['ABANDONED', 'Vault', 'Hand Hole', 'Junction Box', 'Pull Box', 'Handhole', 'Manhole', 'New', 'NEW', 'NA', 'Null', 'unk', 'Unk', 'UNK', 'Unknown', 'UNKNOWN', '99999', 'Awaiting Maximo Record', 'TBD', 'LEMOOR-U89', 'Airfield Light', 'DropInlet', '068111M', '088111M', 'PORHUE-U73', 'POIMUG-S31', 'POIMUG-S5', 'CHILAK-S72', 'LEMOOR-U13', '32052', 'Parking Lot Light', 'Street Light', '280060', '2-07516SL', 'Security Light', 'BASNI27 TAXI LIGHT', 'LEMOOR-U80', 'CurbInlet', 'CHILAK-S12', 'Private', '200753', 'UMA254000224', '2-08301PL', '068111MAREA12', 'CatchBasin', 'R84714', 'Unk', 'R126016', 'CurbCut', 'BASNIS17  LIGHTING', 'R84642', '200534', '066311MAREA01', 'R56663', 'R72084', 'R126248', 'CHILAK-S14', '068111MAREA02', '068111MPIER07', 'UMA254000222', 'R126084', 'R84709', '068111MPIER13', '068111MPIER02', 'CHILAK-41252', '068111MPIER03', '068111MPIER04', 'R126242', '068111MPIER08', 'R116581', '068111MPIER05', '068111MPIER10', 'Traffic Light', 'R146796', '068111MPIER12', '086311MAREA01', 'POIMUG-200327', 'R84691', 'LTG-SEC', 'R126507', 'R126514', 'R84673', 'NBC-N-12', 'UMA254000226', 'IID', '068111MPIER01', '068111MPIER06', 'NBSD-PW-SA-PR10', '118311MAREA03', 'Asset creation required', 'R84695', '289062', '118311MAREA02', '118311MAREA01', 'R126177', 'Riser', 'R116524', 'R126520', 'Walkway Light', '0', 'CHILAK-U19', '086311MAREA06', 'R83758', 'R84677', 'Recreation Field Light', 'R126189', 'PipeInlet', '&amp;lt;Null&amp;gt;', 'NOT IN MAXIMO', 'UMA339000429', 'UMA260000011', 'R143822', '086311MAREA06-SDG&amp;amp;E', 'POIMUG-SS', 'UMA254000225', '025128STAC-01', 'Abn', 'No', 'R126178', 'R126183', 'R126190', '086311MAREA07', 'CHILAK-02755', 'R116520', 'R45432', '086311MAREA05', 'Asset creation needed', 'NASSCO', 'NEEDNEW_WASDUPE', 'location needed', 'N/A', 'UNKNOWN', 'BoxInlet', 'Other', '+', 'WELL'] 

idpk = when(Boolean(IndexOf(badvals, idpk)+1), '', idpk) 
maxid = when(Boolean(IndexOf(badvals, maxid)+1), '', maxid) 
fn = when(Boolean(IndexOf(badvals, fn)+1), '', fn) 

fn = when(Count(fn) &amp;gt; 20, trim(Right(fn, 20)), fn) 

if (metro_tf == True) 
    { 
    var maxidvalid = when(!IsEmpty(typeassetnum), True, False) 
    var typefeatidvalid = when(!IsEmpty(typefeatid) &amp;amp;&amp;amp; maxid != typefeatid, True, False) 
    idpk = when(maxidvalid == True &amp;amp;&amp;amp; typefeatidvalid == True, typefeatid, idpk) 
    var hyd = when(Find('HYD', maxid) != -1, True, False) 
    if (hyd == True) 
        { 
        var hydptct = when(hyd == True, Count(Split(maxid, 'HYD')), 0) 
        var hydpt1 = when(hyd == True &amp;amp;&amp;amp; hydptct == 2, trim(Split(maxid, 'HYD')[0]), '') 
        var hydpt2 = when(hyd == True &amp;amp;&amp;amp; hydptct == 2, trim(Split(maxid, 'HYD')[1]), '') 
        maxid = when(hydptct == 2 &amp;amp;&amp;amp; hydpt2 != '', Concatenate(['HYD', hydpt2]), 
                 hydptct == 2 &amp;amp;&amp;amp; hydpt2 == '', maxid, 
                     maxid 
                 )    
        } 
    else 
        {maxid = when(Count(maxid) &amp;gt;= 5, "*"+trim(Right(maxid, 5)), maxid)}  
    Console(when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, ''))
    return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, '') 
   } 

   if (metro_tf == False) 
   { 
   var maxidvalid = when(!IsEmpty(typeassetnum), True, False) 
   var typefeatidvalid = when(!IsEmpty(typefeatid), True, False) 
   idpk = when(maxidvalid == True &amp;amp;&amp;amp; typefeatidvalid == True, typefeatid, idpk) 
   //return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(fn), fn, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(fn), maxid, '') 
   Console(when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(maxid), maxid, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(maxid) &amp;amp;&amp;amp; !IsEmpty(fn), fn, ''))
   return when(!IsEmpty(idpk), idpk, IsEmpty(idpk) &amp;amp;&amp;amp; !IsEmpty(maxid), maxid, IsEmpty(idpk) &amp;amp;&amp;amp; IsEmpty(maxid) &amp;amp;&amp;amp; !IsEmpty(fn), fn, '') 
  } &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Console() output in the messages tab, which mirror the Return statements, also shows the correct label value.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 18:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324869#M54333</guid>
      <dc:creator>JPrescott</dc:creator>
      <dc:date>2023-09-01T18:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Labels not displaying in Map Viewer although Arcade expression tests successfully</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324949#M54339</link>
      <description>&lt;P&gt;Even though the code will work in the test, the HasKey function will return the false value in the Labeling Profile. So a simple test like this will return 'Yes' in the console, but 'No' in the map.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var idpk = When(Haskey($feature, 'Field_ID'), 'Yes', 'No');
return idpk&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HasKey.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79706i7FBF30ACE2F80315/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HasKey.png" alt="HasKey.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The Popup profile does have access to this function, so if I add that expression to the popup, it shows up as Yes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HasKey1.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79707i776A73CD3039883F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HasKey1.png" alt="HasKey1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now the weird thing is, if I zoom in and out a couple of times, suddenly the labels are getting changed to "Yes"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HasKey2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79708i896411F2E3F54FB5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HasKey2.png" alt="HasKey2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did another test by creating a new map with the same data and only adding the label expression, but not the popup expression. If I zoomed in and out enough times, the labels changed to "Yes".&lt;/P&gt;&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6336318286112w1050h540r629" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6336318286112" data-account="6161463677001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6161463677001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6336318286112w1050h540r629');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.esri.com/t5/video/gallerypage/video-id/6336318286112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;&lt;P&gt;When I save the map and open it again, the labels are showing up as "Yes".&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 20:39:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324949#M54339</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-01T20:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Labels not displaying in Map Viewer although Arcade expression tests successfully</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324952#M54340</link>
      <description>&lt;P&gt;I did one more test. I added a new layer and use the same label expression, with the labels showing "No" as expected. However, without zooming, I save the map and reopened it. Now the label say "Yes".&lt;/P&gt;&lt;P&gt;So try saving your map and seeing if the labels come up when you reopen it.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 20:47:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/labels-not-displaying-in-map-viewer-although/m-p/1324952#M54340</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-01T20:47:26Z</dc:date>
    </item>
  </channel>
</rss>

