<?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: Using Arcane to set CIMPrimitiveOverride with if statement in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572139#M86314</link>
    <description>&lt;P&gt;To follow up on this I am trying to add a string builder. It tells me a comma is expected on this formatting. Not sure if there is an issue with checking for null or if arcane has a different way to check&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;return IIf($feature.ageCategory != null, 'url.com/order-' + $feature.age + '.png', '//url/order-0.png'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 02 Jan 2025 16:54:04 GMT</pubDate>
    <dc:creator>ChaosSteve</dc:creator>
    <dc:date>2025-01-02T16:54:04Z</dc:date>
    <item>
      <title>Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572088#M86309</link>
      <description>&lt;P&gt;I am working with primitive overrides to change the image URL of for a feature. I want to set the&amp;nbsp;CIMPictureMarker based on an attribute. Eventually my if statement will grow more complex, but I am starting with a basic change out of the image URL.&lt;/P&gt;&lt;P&gt;I have created a script tag in my HTML to return a different image based on the value of an attribute&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;script &lt;/SPAN&gt;&lt;SPAN&gt;type&lt;/SPAN&gt;&lt;SPAN&gt;="text/javascript" &lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;="serviceTag"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;if&lt;/SPAN&gt;($feature.&lt;SPAN&gt;open&lt;/SPAN&gt;){&lt;BR /&gt;            &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;"https://myURL/order-green.png"&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;SPAN&gt;else &lt;/SPAN&gt;{&lt;BR /&gt;            &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;"https://myURL/order-red.png"&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Then I reference that element and put it into my&amp;nbsp;valueExpressionInfo&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;&lt;SPAN&gt;serviceArcade &lt;/SPAN&gt;= &lt;SPAN&gt;document&lt;/SPAN&gt;.&lt;SPAN&gt;getElementById&lt;/SPAN&gt;(&lt;SPAN&gt;"serviceTag"&lt;/SPAN&gt;).&lt;SPAN&gt;text&lt;/SPAN&gt;;&lt;BR /&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;&lt;SPAN&gt;serviceOrderRenderer &lt;/SPAN&gt;=  {&lt;BR /&gt;    &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;"simple"&lt;/SPAN&gt;,&lt;BR /&gt;        &lt;SPAN&gt;symbol&lt;/SPAN&gt;: &lt;SPAN&gt;new &lt;/SPAN&gt;CIMSymbol({&lt;BR /&gt;        &lt;SPAN&gt;data&lt;/SPAN&gt;: {&lt;BR /&gt;            &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;'CIMSymbolReference'&lt;/SPAN&gt;,&lt;BR /&gt;            &lt;SPAN&gt;primitiveOverrides&lt;/SPAN&gt;: [&lt;BR /&gt;                {&lt;BR /&gt;                    &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;'CIMPrimitiveOverride'&lt;/SPAN&gt;,&lt;BR /&gt;                    &lt;SPAN&gt;primitiveName&lt;/SPAN&gt;: &lt;SPAN&gt;'imageColorOverride'&lt;/SPAN&gt;,&lt;BR /&gt;                    &lt;SPAN&gt;propertyName&lt;/SPAN&gt;: &lt;SPAN&gt;'url'&lt;/SPAN&gt;,&lt;BR /&gt;                    &lt;SPAN&gt;valueExpressionInfo&lt;/SPAN&gt;: {&lt;BR /&gt;                        &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;'CIMExpressionInfo'&lt;/SPAN&gt;,&lt;BR /&gt;                        &lt;SPAN&gt;expression&lt;/SPAN&gt;: &lt;SPAN&gt;serviceArcade&lt;/SPAN&gt;,&lt;BR /&gt;                        &lt;SPAN&gt;returnType&lt;/SPAN&gt;: &lt;SPAN&gt;'Default'&lt;/SPAN&gt;,&lt;BR /&gt;                    },&lt;BR /&gt;                }&lt;BR /&gt;            ],&lt;BR /&gt;            &lt;SPAN&gt;symbol&lt;/SPAN&gt;: {&lt;BR /&gt;                &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;'CIMPointSymbol'&lt;/SPAN&gt;,&lt;BR /&gt;                &lt;SPAN&gt;primativeName&lt;/SPAN&gt;: &lt;SPAN&gt;"imageMarker"&lt;/SPAN&gt;,&lt;BR /&gt;                &lt;SPAN&gt;symbolLayers&lt;/SPAN&gt;: [&lt;BR /&gt;                    {&lt;BR /&gt;                        &lt;SPAN&gt;type&lt;/SPAN&gt;: &lt;SPAN&gt;"CIMPictureMarker"&lt;/SPAN&gt;,&lt;BR /&gt;                        &lt;SPAN&gt;enable&lt;/SPAN&gt;: &lt;SPAN&gt;true&lt;/SPAN&gt;,&lt;BR /&gt;                        &lt;SPAN&gt;primitiveName&lt;/SPAN&gt;: &lt;SPAN&gt;'imageColorOverride'&lt;/SPAN&gt;,&lt;BR /&gt;                    },&lt;BR /&gt;                ],&lt;BR /&gt;            },&lt;BR /&gt;        }&lt;BR /&gt;    })&lt;BR /&gt;}&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;It gives me an errors saying&amp;nbsp;&lt;SPAN&gt;ParsingError: Unexpected identifier. Why does it say it cant parse an if statement?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 14:32:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572088#M86309</guid>
      <dc:creator>ChaosSteve</dc:creator>
      <dc:date>2025-01-02T14:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572091#M86310</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/765685"&gt;@ChaosSteve&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may be because the if statements in Arcade are slightly different, would replacing your if statement with this be fruitful?&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;&amp;lt;script type="text/javascript" id="serviceTag"&amp;gt;
    return IIf($feature.open, "https://myURL/order-green.png", "https://myURL/order-red.png");
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Cody&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 14:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572091#M86310</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-01-02T14:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572116#M86311</link>
      <description>&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/?tagged=Arcade" target="_self"&gt;Arcade samples&lt;/A&gt; use the "text/plain" attribute generally with inline scripts and the "text/javascript" attribute with external .js files. Does this fix your parsing error?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script type="text/plain" id="serviceTag"&amp;gt;
        if($feature.open){
            return "https://myURL/order-green.png"
        }else {
            return "https://myURL/order-red.png"
        }
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:03:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572116#M86311</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-01-02T16:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572134#M86312</link>
      <description>&lt;P&gt;It looks like an attribute cannot be a boolean, so I have it set to a string. My new code is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;script &lt;/SPAN&gt;&lt;SPAN&gt;type&lt;/SPAN&gt;&lt;SPAN&gt;="text/plain" &lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;="serviceOrderTag"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;return IIf($feature.open === "true", 'https://myURL/order-green.png',&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        'https://myURL/order-red.png');&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;This is working&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:51:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572134#M86312</guid>
      <dc:creator>ChaosSteve</dc:creator>
      <dc:date>2025-01-02T16:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572135#M86313</link>
      <description>&lt;P&gt;This was also part of the issue&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:51:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572135#M86313</guid>
      <dc:creator>ChaosSteve</dc:creator>
      <dc:date>2025-01-02T16:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572139#M86314</link>
      <description>&lt;P&gt;To follow up on this I am trying to add a string builder. It tells me a comma is expected on this formatting. Not sure if there is an issue with checking for null or if arcane has a different way to check&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;return IIf($feature.ageCategory != null, 'url.com/order-' + $feature.age + '.png', '//url/order-0.png'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572139#M86314</guid>
      <dc:creator>ChaosSteve</dc:creator>
      <dc:date>2025-01-02T16:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcane to set CIMPrimitiveOverride with if statement</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572142#M86315</link>
      <description>&lt;P&gt;Missing ending bracket. Fixed&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:59:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-arcane-to-set-cimprimitiveoverride-with-if/m-p/1572142#M86315</guid>
      <dc:creator>ChaosSteve</dc:creator>
      <dc:date>2025-01-02T16:59:56Z</dc:date>
    </item>
  </channel>
</rss>

