<?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 Re: Arcade popup expression works in test doesn't work in popup in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-popup-expression-works-in-test-doesn-t-work/m-p/1362033#M76489</link>
    <description>&lt;P&gt;Resolved the issue. I needed to add this to the beginning of the expression:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Expects($feature, '*')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/td-p/1241182" target="_self"&gt;This community post&lt;/A&gt; helped me get there.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 15:41:55 GMT</pubDate>
    <dc:creator>ElisabethFenn</dc:creator>
    <dc:date>2023-12-18T15:41:55Z</dc:date>
    <item>
      <title>Arcade popup expression works in test doesn't work in popup</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-popup-expression-works-in-test-doesn-t-work/m-p/1349865#M75220</link>
      <description>&lt;P&gt;I am trying to create popups in map viewer that show different fields depending on the activity type of the polygon. I've written this expression (see below) and when I run it in the expression editor it works perfectly. When I look at my popup, I get all of the correct field names, but only some of the data. Any idea what I'm missing here? Photos attached of what I see in the test space vs the popup.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//create feature set from Activities layer
var fs = FeatureSetByName($map, 'Activities')

//define categories of activity types
var harvest = ['Clearcut','Overstory Removal','Improvement Thinning','Cluster Thinning','Free Thinning','Thinning From Above (Release Cut)','Crown Thinning','Crop Tree Release','Early Commercial Thinning','Group Shelterwood','Two-Stage Shelterwood','Three-Stage Shelterwood','Irregular Shelterwood','Deferred or Low Density Shelterwood','Shelterwood w/Reserves or Retention','Patch Cuts or Progressive Clearcuts','Seed Tree','Strip Cuts','Group Selection','Individual Tree Selection','Combined Group &amp;amp; Individual Tree Sel','Salvage Harvest','Wildlife Habitat Improvement']
var sitePrep = ['Chemical Site Prep','Mechanical Site Prep']
var inventory = ['Cruise','Planting','Survival','Crown Closure','Carbon Cruise','Growth and Yield','Audit Cruise','EFI','Post Ops Cruise','Permanent Growth Plots','CFI','Regen','Maple Taps',]

//define fields to display for each category
var harvestfields = ['Type','Status','JOB_NAME','Activity_Manager','ForestryNotificationfNum','CERTIFICATION','EASEMENT','T_E_PRESENCE','Method','HU_STATUS','EstimatedStart','ActualStart','EstimatedStop','ActualEnd','Contractor','Subcontractor','ACRES','MGT_RESTRICTION','RESTRICTION_DSC','Budget','EstimatedGrossRevenue','ActualGrossRevenue','EstimatedNetRevenue','ActualNetRevenue','OPERABILITY','Season','MARKED','StandAge','SILV_SYS','Document_Link','NOTES','Township','County','State','LVI_CODE','CreatedBy','CreatedOn','ModifiedBy','ModifiedOn','SUPER_TYPE','CERT_NUMB','Prescriptions','POST_OP_STATUS','POST_OP_STRATA','POST_OP_OS_TYPE','POST_OP_US_TYPE','OS_SP_1','OS_SP_2','US_SP_1','US_SP_2','OvYrEstabR','UnYrEstabR','YR_COMPLETE']
var siteprepfields = ['Type','Status','JOB_NAME','Activity_Manager','CERTIFICATION','EASEMENT','T_E_PRESENCE','Method','EstimatedStart','ActualStart','EstimatedStop','ActualEnd','Contractor','Subcontractor','ACRES','MGT_RESTRICTION','RESTRICTION_DSC','Budget','TotalEstimatedCost','TotalActualCost','EstimatedLaborCost','ActualLaborCost','EstimatedMaterialsCost','ActualMaterialsCost','OPERABILITY','Season','PRE_COM_TREATMENT_1','PRE_COM_TREATMENT_2','PRE_COM_YR_1','PRE_COM_YR_2','StandAge','Document_Link','NOTES','Township','County','State','LVI_Code','CreatedBy','CreatedOn','ModifiedBy','ModifiedOn']
var inventoryfields = ['Type','Status','JOB_NAME','Activity_Manager','CERTIFICATION','EASEMENT','EstimatedStart','ActualStart','EstimatedStop','ActualEnd','Contractor','ACRES','Method','Budget','TotalEstimatedCost','TotalActualCost','EstimatedLaborCost','ActualLaborCost','EstimatedMaterialsCost','ActualMaterialsCost','Miscellaneous_Cost','Project_Source','Document_Link','NOTES','Township','County','State','LVI_Code','CreatedBy','CreatedOn','ModifiedBy','ModifiedOn']

//create popup
function createPopup (fieldsList) {
  var popup = ''
  for (var f in fieldslist){
    var field = fieldslist[f]
    var value = DomainName(fs, field, $feature[field])
    popup += field + ": " + value + TextFormatting.NewLine
  }
  return popup
}

//call createPopup function
if (Includes(harvest, DomainName($feature, 'Type'))) {
  createPopup(harvestfields)
} else if (Includes(sitePrep, DomainName($feature, 'Type'))) {
  createPopup(siteprepfields)
} else if (Includes(inventory, DomainName($feature, 'Type'))) {
  createPopup(inventoryfields)
} else {
  return "not found"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 19:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-popup-expression-works-in-test-doesn-t-work/m-p/1349865#M75220</guid>
      <dc:creator>ElisabethFenn</dc:creator>
      <dc:date>2023-11-15T19:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade popup expression works in test doesn't work in popup</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-popup-expression-works-in-test-doesn-t-work/m-p/1362033#M76489</link>
      <description>&lt;P&gt;Resolved the issue. I needed to add this to the beginning of the expression:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Expects($feature, '*')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-expression-returns-value-in-popup-in-map/td-p/1241182" target="_self"&gt;This community post&lt;/A&gt; helped me get there.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 15:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-popup-expression-works-in-test-doesn-t-work/m-p/1362033#M76489</guid>
      <dc:creator>ElisabethFenn</dc:creator>
      <dc:date>2023-12-18T15:41:55Z</dc:date>
    </item>
  </channel>
</rss>

