<?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 pop-up expression quesiton in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320390#M72275</link>
    <description>&lt;P&gt;Template literals in Arcade enclose the value you want to insert into the string with `&lt;STRONG&gt;${&lt;/STRONG&gt;value&lt;STRONG&gt;}&lt;/STRONG&gt;`. Not to be confused with the leading dollar sign on global variables like &lt;STRONG&gt;$feature&lt;/STRONG&gt;, &lt;STRONG&gt;$datastore&lt;/STRONG&gt;, &lt;STRONG&gt;$map&lt;/STRONG&gt;, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function heterotrophs() {
  return `${$feature['where_is_it_located_does_this_l']}
${$feature['does_this_location_look_like_it']}
${$feature['note_the_physical_description_s']}
${$feature['note_its_behavior_mode_of_locom']}
${$feature['what_do_you_think_it_might_eat']}`
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;If the $ is placed correctly, will the output display the actual answers?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Yes, it should display the actual field values for the feature you clicked on. If you also want to display the question/field name, you could take my answer or put the questions into the functions of Ken's answer like so:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function heterotrophs() {
  return `Where is it located: ${$feature['where_is_it_located_does_this_l']}
Does this location look like it: ${$feature['does_this_location_look_like_it']}
Note the physical description: ${$feature['note_the_physical_description_s']}
Note its behavior mode: ${$feature['note_its_behavior_mode_of_locom']}
What do you think it might eat: ${$feature['what_do_you_think_it_might_eat']}`
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Aug 2023 07:12:43 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-08-19T07:12:43Z</dc:date>
    <item>
      <title>Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320283#M72254</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to Arcade but do have some coding knowledge.&amp;nbsp; I'm creating a web map for a teacher whose students are collecting data outside using Survey123.&amp;nbsp; The survey is set up to collect data on 3 different categories, Autotrophs, Heterotrophs, and Ambiotic Conditions.&amp;nbsp; Once a category is selected, the accompanying group of questions displays.&amp;nbsp; Each category aligns with a different group of questions.&lt;/P&gt;&lt;P&gt;Once the data is collected, a map will be generated.&amp;nbsp; When a student clicks on the symbol/point that represents an autotroph, I'd like for only the group of autotroph questions to display in the pop-up.&amp;nbsp; Same with the heterotroph and abiotic condition points.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where would I go to learn how to code this specific display?&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:04:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320283#M72254</guid>
      <dc:creator>JGVadnais1</dc:creator>
      <dc:date>2023-08-18T19:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320315#M72257</link>
      <description>&lt;P&gt;You could do something like this. It uses &lt;A href="https://developers.arcgis.com/arcade/guide/functions/" target="_self"&gt;Functions&lt;/A&gt; in the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; to create the different output for each type. Those functions also use &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;template literals&lt;/A&gt; to put the answer to each question on its own line.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function autotrophs() {
  return `{$feature['autotrophQuestion1']}
{$feature['autotrophQuestion2']}`
}

function heterotrophs() {
  return `{$feature['heterotrophQuestion1']}
{$feature['heterotrophQuestion2']}
{$feature['heterotrophQuestion3']}`
}

function ambiotic() {
  return `{$feature['ambioticQuestion1']}
{$feature['ambioticQuestion2']}
{$feature['ambioticQuestion3']}
{$feature['ambioticQuestion4']}`
}

When($feature.Condition == 'Autotrophs', autotrophs,
     $feature.Condition == 'Heterotrophs', heterotrophs,
     $feature.Condition == 'Ambiotic', ambiotic,
     'Invalid');
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320315#M72257</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-08-18T19:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320316#M72258</link>
      <description>&lt;P&gt;Wow!&amp;nbsp; Thank you so much.&amp;nbsp; I'm going to start working on this straight away.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:57:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320316#M72258</guid>
      <dc:creator>JGVadnais1</dc:creator>
      <dc:date>2023-08-18T19:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320342#M72262</link>
      <description>&lt;P&gt;That's a really clean solution, but you need the $ signs in front of the curly braces in the string literals, and you need the parantheses behind the function names in the When call.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 21:13:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320342#M72262</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-18T21:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320346#M72263</link>
      <description>&lt;P&gt;Another way to do this, showing both field aliases / names and the values (edit lines 3,4,5,8):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// define the fields that should be displayed
var display_fields = {
  "Autotroph": ["Field1", "Field2", "Field3"],
  "Heterotroph": ["Field4", "Field5", "Field6", "Field7"],
  "Abiotic": ["Field8", "Field9"],
}
// get the requested fields based on your condition
var requested_fields = display_fields[$feature.Condition]


// Calling fields by variable instead of string literal can be icky,
// so we should tell Arcade that we expect all fields to be loaded
Expects($feature, "*")

// create a dictionary of {field_name: field_alias}
var fields = Schema($feature).fields
var aliases = {}
for(var f in fields) {
  aliases[fields[f].name] = fields[f].alias
}

// define an empty array that stores the output lines
var popup_lines = []

// loop over the requested field names
for(var f in requested_fields) {
  // get the name, alias, and value of the field
  var name = requested_fields [f]
  var alias = aliases[name]
  var value = $feature[name]
  // append to the lines
  Push(popup_lines, `${alias}: ${value}`)
}
// concatenate and return
return Concatenate(popup_lines, TextFormatting.NewLine)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 21:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320346#M72263</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-18T21:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320357#M72268</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Here's the code.&amp;nbsp; I added the (), still unsure of where exactly to place $,&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;function  autotrophs () {
return `
{$feature[$feature.color]}
{$feature['$feature.leaf_size']}
{$feature['$feature.architecture']}
{$feature['$feature.texture']}
{$feature['$feature._number']}
{$feature['$feature.branching_pattern']}
{$feature['$feature.production']}
{$feature['$feature.do_the_leaves_smell_when_you_br']}
{$feature['$feature.do_the_leaves_produce_latex_liq']}
{$feature['$feature.do_you_see_any_evidence_of_dama']}`
}

function heterotrophs() {
  return `{$feature['$feature.where_is_it_located_does_this_l']}
{$feature['$feature.does_this_location_look_like_it']}
{$feature['$feature.note_the_physical_description_s']}
{$feature['$feature.note_its_behavior_mode_of_locom']}
{$feature['$feature.what_do_you_think_it_might_eat']}`
}

function abiotic() {
  return `{$feature['$feature.describe_the_air_temperature_wi']}
{$feature['$feature.select_the_choice_that_bests_de']}
{$feature['$feature.how_strong_is_the_wind']}
{$feature['$feature.sun_strength_cloud_cover_']}
{$feature['$feature.do_you_smell_anything']}
{$feature['$feature.what_do_you_hear_']}
{$feature['$feature.what_do_you_hear_other']}`
}

When($feature.category == 'Autotroph', autotrophs(),
     $feature.category == 'Heterotroph', heterotrophs(),
     $feature.category == 'Abiotic Conditions', abiotic(),
     'Invalid');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JGVadnais1_0-1692398849499.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78567iAE5BCCDB815039C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JGVadnais1_0-1692398849499.png" alt="JGVadnais1_0-1692398849499.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If the $ is placed correctly, will the output display the actual answers?&lt;BR /&gt;&lt;BR /&gt;I really appreciate your support. Thank you. Jenn V&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 22:54:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320357#M72268</guid>
      <dc:creator>JGVadnais1</dc:creator>
      <dc:date>2023-08-18T22:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320390#M72275</link>
      <description>&lt;P&gt;Template literals in Arcade enclose the value you want to insert into the string with `&lt;STRONG&gt;${&lt;/STRONG&gt;value&lt;STRONG&gt;}&lt;/STRONG&gt;`. Not to be confused with the leading dollar sign on global variables like &lt;STRONG&gt;$feature&lt;/STRONG&gt;, &lt;STRONG&gt;$datastore&lt;/STRONG&gt;, &lt;STRONG&gt;$map&lt;/STRONG&gt;, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function heterotrophs() {
  return `${$feature['where_is_it_located_does_this_l']}
${$feature['does_this_location_look_like_it']}
${$feature['note_the_physical_description_s']}
${$feature['note_its_behavior_mode_of_locom']}
${$feature['what_do_you_think_it_might_eat']}`
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;If the $ is placed correctly, will the output display the actual answers?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Yes, it should display the actual field values for the feature you clicked on. If you also want to display the question/field name, you could take my answer or put the questions into the functions of Ken's answer like so:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function heterotrophs() {
  return `Where is it located: ${$feature['where_is_it_located_does_this_l']}
Does this location look like it: ${$feature['does_this_location_look_like_it']}
Note the physical description: ${$feature['note_the_physical_description_s']}
Note its behavior mode: ${$feature['note_its_behavior_mode_of_locom']}
What do you think it might eat: ${$feature['what_do_you_think_it_might_eat']}`
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 07:12:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320390#M72275</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-19T07:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320417#M72279</link>
      <description>&lt;P&gt;Thank you for the assistance and clarification of the dollar signs.&amp;nbsp; Truly helpful!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 21:24:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320417#M72279</guid>
      <dc:creator>JGVadnais1</dc:creator>
      <dc:date>2023-08-19T21:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade pop-up expression quesiton</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320742#M72319</link>
      <description>&lt;P&gt;Thanks for catching my errors!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 15:40:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-pop-up-expression-quesiton/m-p/1320742#M72319</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-08-21T15:40:40Z</dc:date>
    </item>
  </channel>
</rss>

