<?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 expression in Uniquevalue in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1079216#M73886</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/402988"&gt;@kawishabbas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The issue in the valueExpression you have there is that you are using AND instead of &lt;A href="https://developers.arcgis.com/arcade/guide/logic/#operators" target="_self"&gt;&amp;amp;&amp;amp;&lt;/A&gt;. Also you need a default value at the end of the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_blank" rel="noopener"&gt;When()&lt;/A&gt; method in case all of the conditions resolve to false. Here is an example of a valid valueExpression using two fields, similar to what you have. The 10 at the end is the default value in case all of the expressions return false.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const name = "$feature.state_name";
const pop = "$feature.pop2000";

const valueExpression = `When(${pop} &amp;lt; 20000, 0, 
${pop} &amp;gt; 20000 &amp;amp;&amp;amp; ${pop} &amp;lt; 60000, 1, 
${pop} &amp;gt; 60000 &amp;amp;&amp;amp; ${pop} &amp;lt; 100000, 2, 
${pop} &amp;gt; 100000 &amp;amp;&amp;amp; ${name} == 'California', 3,
${pop} &amp;gt; 100000 &amp;amp;&amp;amp; ${name} == 'Texas', 4, 10)`;

const renderer = {
  type: 'unique-value',
  field2: "pop2000",
  valueExpression: valueExpression,
  uniqueValueInfos: [
    {
      value: 0,
      symbol: {
        type: "simple-fill",
        color: "#2D2670",
        style: "solid",
        outline: {
          width: 2,
          color: "#ffffff"
        }
      }
    }, {
      value: 1,
      symbol: {
        type: "simple-fill",
        color: "#FFBA39",
        style: "solid",
        outline: {
          width: 2,
          color: "#ffffff"
        }
      }
    } ...
  ]
} &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a codepen of a sample application with this working. &lt;A href="https://codepen.io/banuelosj/pen/ExmWQyR" target="_blank" rel="noopener"&gt;Sample App&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jose&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 14:57:34 GMT</pubDate>
    <dc:creator>JoseBanuelos</dc:creator>
    <dc:date>2021-07-15T14:57:34Z</dc:date>
    <item>
      <title>Arcade expression in Uniquevalue</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1077208#M73787</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to symbolize my data on behalf of two fields. One is status field and other is category field. I try to used arcade expression for&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;uniqueValueInfos &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;to render the layer but unfortunately it is not working. Please help me to figure out my mistake.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is source code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; const name = "$feature.alarmstate"
const cat = "$feature.category"
        
const valueExpression = `When( ${name} == '0' AND ${cat} == 'VIP', 0, ${name} == '1' AND ${cat} == 'VIP', 0,
            ${name} == '2' AND ${cat} == 'VIP', 0, ${name} == '3' AND ${cat} == 'VIP', 0, 
            ${name} == '4' AND ${cat} == 'VIP', 0, 
            ${name} == '0' AND ${cat} == 'Ordinary', 1, ${name} == '1' AND ${cat} == 'Ordinary', 2,
            ${name} == '2' AND ${cat} == 'Ordinary', 3, ${name} == '3' AND ${cat} == 'Ordinary', 4,
            ${name} == '4' AND ${cat} == 'Ordinary', 5)`

        var rendererCheck = {
            type: "unique-value", 
            //field: "alarminfo",
            valueExpression:valueExpression,
            uniqueValueInfos: [
                {
                    value: "0",
                    symbol: {
                        type: "picture-marker", 
                        url: "images/vip.png",
                        width: "30px",
                        height: "15px"
                    }
                }, {

                    value: "1",
                    symbol: {
                        type: "simple-marker", 
                        style: "diamond",
                        color: "green",
                        size: "10px",
                        outline: { 
                            color: [ 255, 255, 255, 1 ],
                            width: 0.4
                          }
                    }
                }, {

                    value: "2",
                    symbol: {
                        type: "simple-marker", 
                        style: "diamond",
                        color: "blue",
                        size: "10px",
                        outline: { 
                            color: [ 255, 255, 255, 1 ],
                            width: 0.4
                          }
                    }
                }, {

                    value: "3",
                    symbol: {
                        type: "simple-marker", 
                        style: "diamond",
                        color: "red",
                        size: "10px",
                        outline: { 
                            color: [ 255, 255, 255, 1 ],
                            width: 0.4
                          }
                    }
                }, {

                    value: "4",
                    symbol: {
                        type: "simple-marker", 
                        style: "diamond",
                        color: "black",
                        size: "10px",
                        outline: { 
                            color: [ 255, 255, 255, 1 ],
                            width: 0.4
                          }
                    }
                }, {

                    value: "5",
                    symbol: {
                        type: "simple-marker", 
                        style: "diamond",
                        color: "Yellow",
                        size: "10px",
                        outline: { 
                            color: [ 255, 255, 255, 1 ],
                            width: 0.4
                          }
                    }
                }
            ]
        };
        
        customerLayer.renderer =rendererCheck&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 13:23:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1077208#M73787</guid>
      <dc:creator>kawishabbas</dc:creator>
      <dc:date>2021-07-09T13:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression in Uniquevalue</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1079216#M73886</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/402988"&gt;@kawishabbas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The issue in the valueExpression you have there is that you are using AND instead of &lt;A href="https://developers.arcgis.com/arcade/guide/logic/#operators" target="_self"&gt;&amp;amp;&amp;amp;&lt;/A&gt;. Also you need a default value at the end of the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_blank" rel="noopener"&gt;When()&lt;/A&gt; method in case all of the conditions resolve to false. Here is an example of a valid valueExpression using two fields, similar to what you have. The 10 at the end is the default value in case all of the expressions return false.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const name = "$feature.state_name";
const pop = "$feature.pop2000";

const valueExpression = `When(${pop} &amp;lt; 20000, 0, 
${pop} &amp;gt; 20000 &amp;amp;&amp;amp; ${pop} &amp;lt; 60000, 1, 
${pop} &amp;gt; 60000 &amp;amp;&amp;amp; ${pop} &amp;lt; 100000, 2, 
${pop} &amp;gt; 100000 &amp;amp;&amp;amp; ${name} == 'California', 3,
${pop} &amp;gt; 100000 &amp;amp;&amp;amp; ${name} == 'Texas', 4, 10)`;

const renderer = {
  type: 'unique-value',
  field2: "pop2000",
  valueExpression: valueExpression,
  uniqueValueInfos: [
    {
      value: 0,
      symbol: {
        type: "simple-fill",
        color: "#2D2670",
        style: "solid",
        outline: {
          width: 2,
          color: "#ffffff"
        }
      }
    }, {
      value: 1,
      symbol: {
        type: "simple-fill",
        color: "#FFBA39",
        style: "solid",
        outline: {
          width: 2,
          color: "#ffffff"
        }
      }
    } ...
  ]
} &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a codepen of a sample application with this working. &lt;A href="https://codepen.io/banuelosj/pen/ExmWQyR" target="_blank" rel="noopener"&gt;Sample App&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jose&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 14:57:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1079216#M73886</guid>
      <dc:creator>JoseBanuelos</dc:creator>
      <dc:date>2021-07-15T14:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression in Uniquevalue</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1079223#M73887</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/349741"&gt;@JoseBanuelos&lt;/a&gt;&amp;nbsp; to figure out the mistake.&lt;/P&gt;&lt;P&gt;Blessings&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 15:05:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-in-uniquevalue/m-p/1079223#M73887</guid>
      <dc:creator>kawishabbas</dc:creator>
      <dc:date>2021-07-15T15:05:00Z</dc:date>
    </item>
  </channel>
</rss>

