<?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 Dynamic values for labelExpression (MapImageLayer) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-values-for-labelexpression-mapimagelayer/m-p/1084912#M74099</link>
    <description>&lt;P&gt;My application allows for multiple labels (multi-line) for a single sublayer in a MapImageLayer. The only problem is that I need to set the labelClass "&lt;STRONG&gt;useCodedValues&lt;/STRONG&gt;" property to &lt;STRONG&gt;false&lt;/STRONG&gt; for only&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;certain&lt;/STRONG&gt; &lt;/EM&gt;fields, not an all-or-nothing (domain code vs description) for all fields in the labelClass. It needs to be false (show codes rather than descriptions) for a field named "PipeMaterial" in two different sublayers. Domain description values need to be showing for all other label fields.&lt;/P&gt;&lt;P&gt;So my thought was to either:&lt;/P&gt;&lt;P&gt;1) Try to apply multiple label classes to the sublayer if PipeMaterial field is to be labeled, but this doesn't seem possible with a multi-line label setup for MapImageLayers. Maybe I'm wrong?&lt;/P&gt;&lt;P&gt;2) Apply a function to dynamically produce domain code values for those few fields that need to use the code rather than description. Let's assume I've pulled all the codes from a REST query and have them available. (PipeMaterial codes such as "AC" = "Asbestos Cement", "CAST" = "Cast Iron", etc...)&lt;/P&gt;&lt;P&gt;So is the #2 option possible? Let's take this ESRI example below. How could I apply a function to get the actual value of the COUNTY_NAME field and replace it on-the-fly while labeling?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// For Spokane County, WA, label will display: "Spokane County, Washington"
labelClass.labelExpression = '[COUNTY_NAME] CONCAT " County, " CONCAT [STATE_NAME]';&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal using pseudo code:&lt;/P&gt;&lt;P&gt;...if [COUNTY_NAME]&amp;nbsp; value is "Spokane County" then return "SPOK" for the actual label output value&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 15:41:30 GMT</pubDate>
    <dc:creator>Andy_Morgan</dc:creator>
    <dc:date>2021-08-02T15:41:30Z</dc:date>
    <item>
      <title>Dynamic values for labelExpression (MapImageLayer)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-values-for-labelexpression-mapimagelayer/m-p/1084912#M74099</link>
      <description>&lt;P&gt;My application allows for multiple labels (multi-line) for a single sublayer in a MapImageLayer. The only problem is that I need to set the labelClass "&lt;STRONG&gt;useCodedValues&lt;/STRONG&gt;" property to &lt;STRONG&gt;false&lt;/STRONG&gt; for only&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;certain&lt;/STRONG&gt; &lt;/EM&gt;fields, not an all-or-nothing (domain code vs description) for all fields in the labelClass. It needs to be false (show codes rather than descriptions) for a field named "PipeMaterial" in two different sublayers. Domain description values need to be showing for all other label fields.&lt;/P&gt;&lt;P&gt;So my thought was to either:&lt;/P&gt;&lt;P&gt;1) Try to apply multiple label classes to the sublayer if PipeMaterial field is to be labeled, but this doesn't seem possible with a multi-line label setup for MapImageLayers. Maybe I'm wrong?&lt;/P&gt;&lt;P&gt;2) Apply a function to dynamically produce domain code values for those few fields that need to use the code rather than description. Let's assume I've pulled all the codes from a REST query and have them available. (PipeMaterial codes such as "AC" = "Asbestos Cement", "CAST" = "Cast Iron", etc...)&lt;/P&gt;&lt;P&gt;So is the #2 option possible? Let's take this ESRI example below. How could I apply a function to get the actual value of the COUNTY_NAME field and replace it on-the-fly while labeling?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// For Spokane County, WA, label will display: "Spokane County, Washington"
labelClass.labelExpression = '[COUNTY_NAME] CONCAT " County, " CONCAT [STATE_NAME]';&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal using pseudo code:&lt;/P&gt;&lt;P&gt;...if [COUNTY_NAME]&amp;nbsp; value is "Spokane County" then return "SPOK" for the actual label output value&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 15:41:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-values-for-labelexpression-mapimagelayer/m-p/1084912#M74099</guid>
      <dc:creator>Andy_Morgan</dc:creator>
      <dc:date>2021-08-02T15:41:30Z</dc:date>
    </item>
  </channel>
</rss>

