<?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 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175165#M77374</link>
    <description>&lt;P&gt;For example, there are three services here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoquez_0-1652892087942.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41617iD5397E62FEF7E630/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hoquez_0-1652892087942.png" alt="Hoquez_0-1652892087942.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 16:41:34 GMT</pubDate>
    <dc:creator>Hoquez</dc:creator>
    <dc:date>2022-05-18T16:41:34Z</dc:date>
    <item>
      <title>Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175084#M77362</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm trying to configure pops-ups. The following expression works fine.&lt;/P&gt;&lt;P&gt;var formatService = When($datapoint["services_offered"]=='Health_Department/Clinics' , ‘Health Department/Clinics ’)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the expression is given below doesn't works.&lt;/P&gt;&lt;P&gt;var formatService = When($datapoint["services_offered"]=='Health_Department/Clinics' &amp;amp; 'Family_Planning_Birth_Control_S', ‘Health Department/Clinics and Family Planning Birth Control Services’)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please share your thought?&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 15:00:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175084#M77362</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T15:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175112#M77367</link>
      <description>&lt;P&gt;&amp;amp; would require&amp;nbsp;&lt;EM&gt;both&amp;nbsp;&lt;/EM&gt;statements to be true, and the second "statement" is just a string of text. Also, it needs to be "&amp;amp;&amp;amp;" in Arcade.&lt;/P&gt;&lt;P&gt;The properly-written version of your statement would be:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;When($datapoint["services_offered"]=='Health_Department/Clinics' &amp;amp;&amp;amp; $datapoint["services_offered"]=='Family_Planning_Birth_Control_S', ‘Health Department/Clinics and Family Planning Birth Control Services’)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But of course, your field can't be equal to two values, so what you ought to use is "||" to return the value when it matches&amp;nbsp;&lt;EM&gt;either&lt;/EM&gt; statement. Also, consider throwing that field into a variable first, to make your expression more concise.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;var svcs = $datapoint["services_offered"]&lt;BR /&gt;var formatService = When(svcs == 'Health_Department/Clinics' || svcs =='Family_Planning_Birth_Control_S', ‘Health Department/Clinics and Family Planning Birth Control Services’)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Of course, you could also make use of another function here:&amp;nbsp;&lt;STRONG&gt;Includes&lt;/STRONG&gt;. And also, when you are only checking a single statement, you can use&amp;nbsp;&lt;STRONG&gt;Iif&lt;/STRONG&gt; as well, though either will work. Both&amp;nbsp;require a default value provided at the end, if I'm not mistaken.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var svcs = $datapoint["services_offered"]

var matches = [
    'Health_Department/Clinics',
    'Family_Planning_Birth_Control_S'
]

var formatService = When(Includes(matches, svcs), 'Health Department / Clinics and Family Planning Birth Control Services', '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;But then, that output string really doesn't make sense if an either/or match.&lt;/P&gt;&lt;P&gt;You'll probably need to provide more information about your data and what you're trying to do.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 15:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175112#M77367</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-18T15:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175139#M77369</link>
      <description>&lt;P&gt;Thanks, Josh for your comment. I really appreciate your help. I'm trying to configure pop-ups on the dashboard. The full code is following-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var formatService = When($datapoint["services_offered"]=='Health_Department/Clinics','Health Department/Clinics',$datapoint["services_offered"]=='Violence_Neglect_&amp;amp;_Abuse_Relate', 'Violence, Neglect, and Abuse Related Services', $datapoint["services_offered"]=='Healthcare_Services', 'Healthcare Services', $datapoint["services_offered"]=='Financial_Food_Clothing_&amp;amp;_Housi', 'Financial, Food, Clothing, and Housing Services', $datapoint["services_offered"]=='Violence_Neglect_&amp;amp;_Abuse_Relate', 'Violence, Neglect, and Abuse Related Services', $datapoint["services_offered"]=='Educational_Resources', 'Educational Resources', $datapoint["services_offered"]=='Pregnancy_Crisis_Services', 'Pregnancy Crisis Services', $datapoint["services_offered"]=='Child_Care_&amp;amp;_Day_Care_Services_', 'Public Child Care &amp;amp; Day Care Services', $datapoint["services_offered"]=='Counseling_&amp;amp;_Mental_Health_Serv', 'Counseling &amp;amp; Mental Health Services', $datapoint["services_offered"]=='Adoption_Choices', 'Adoption Choices', $datapoint["services_offered"]=='Crisis_Emergency_Services', 'Crisis Emergency Services', $datapoint["services_offered"]=='Employment_Services', 'Employment Services', $datapoint["services_offered"]=='Family_Planning_Birth_Control_S', 'Family Planning Birth Control Services', $datapoint["services_offered"]=='Health_Related_Other_Resources', 'Other Health Related Resources', $datapoint["services_offered"]=='Legal_Services', 'Legal Services', $datapoint["services_offered"]=='Pregnancy_Crisis_Services', 'Crisis Pregnancy Services', $datapoint["services_offered"]=='Special_Needs', 'Special Needs', $datapoint["services_offered"]=='Substance_Abuse_Support_&amp;amp;_Treat', 'Substance Abuse Support &amp;amp; Treatment Services', $datapoint["services_offered"]=='Transportation', 'Transportation', defaultValue)&lt;/P&gt;&lt;P&gt;var formatName = IIf(DomainName($datapoint,"agency_or_facility_name")=='Other', $datapoint["agency_or_facility_name_other"], DomainName($datapoint,"agency_or_facility_name"))&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;textColor: '',&lt;BR /&gt;backgroundColor: '',&lt;BR /&gt;separatorColor:'',&lt;BR /&gt;selectionColor: '',&lt;BR /&gt;selectionTextColor: '',&lt;BR /&gt;attributes: {&lt;BR /&gt;formatService: formatService,&lt;BR /&gt;formatName: formatName&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is working fine. However, I need to show two services for some areas. I tried different ways including your suggestion. But I haven't come up with any solution yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add another service in pop-ups (see red arrow on the image)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoquez_1-1652890281004.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41612i77524B064B03D011/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hoquez_1-1652890281004.png" alt="Hoquez_1-1652890281004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I really appreciate your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:11:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175139#M77369</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T16:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175144#M77370</link>
      <description>&lt;P&gt;So, what does the data actually look like when there are two?&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:18:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175144#M77370</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-18T16:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175152#M77371</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can't execute arcade scripts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoquez_0-1652891440246.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41614i7FF7274B976A6912/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hoquez_0-1652891440246.png" alt="Hoquez_0-1652891440246.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:30:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175152#M77371</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T16:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175155#M77372</link>
      <description>&lt;P&gt;No no, I mean what does the actual row of the source data table look like? How can there be two values in a single field?&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:32:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175155#M77372</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-18T16:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175159#M77373</link>
      <description>&lt;P&gt;The data come from a hosted layer generated by a survey through survey123. In that survey, one question was about which services are available. There are 7/8 options for that question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175159#M77373</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T16:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175165#M77374</link>
      <description>&lt;P&gt;For example, there are three services here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hoquez_0-1652892087942.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41617iD5397E62FEF7E630/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hoquez_0-1652892087942.png" alt="Hoquez_0-1652892087942.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:41:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175165#M77374</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T16:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175192#M77375</link>
      <description>&lt;P&gt;My issue is solved. I want to say thank you, Josh. I really appreciate your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:07:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175192#M77375</guid>
      <dc:creator>Hoquez</dc:creator>
      <dc:date>2022-05-18T17:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175209#M77377</link>
      <description>&lt;P&gt;No problem! I was writing up a possible expression for you to use that makes use of Split and Decode:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var svcs = $datapoint['services_offered']

// Split up the value
var svc_array = Split(svcs, ',')

// Iterate over each service
for (var s in svc_array){
    
    // Strip out "_"
    svc_array[s] = Replace(svc_array[s], '_', ' ')
    
    // Format remaining values
    svc_array[s] = Decode(
        svc_array[s],
        'Violence Neglect &amp;amp; Abuse Relate', 'Violence, Neglect, and Abuse Related Services',
        'Financial Food Clothing &amp;amp; Housi', 'Financial, Food, Clothing, and Housing Services',
        'Counseling &amp;amp; Mental Health Serv', 'Counseling &amp;amp; Mental Health Services',
        'Family Planning Birth Control S', 'Family Planning Birth Control Services',
        'Health_Related_Other_Resources',  'Other Health Related Resources',
        'Substance Abuse Support &amp;amp; Treat', 'Substance Abuse Support &amp;amp; Treatment Services',
        svc_array[s]
        )
}

// Merge values back into single string
return Concatenate(svc_array, ', ')&lt;/LI-CODE&gt;&lt;P&gt;Testing it out on a sample value like&amp;nbsp;&lt;STRONG&gt;Family_Planning_Birth_Control_S,Health_Department/Clinics&lt;/STRONG&gt;, I get the following response:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1652895072386.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41627iA3ED5B11D1FF7741/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1652895072386.png" alt="jcarlson_0-1652895072386.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade/m-p/1175209#M77377</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-05-18T17:31:08Z</dc:date>
    </item>
  </channel>
</rss>

