<?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.  First two functions work, while third fails. in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093856#M1036</link>
    <description>&lt;P&gt;Josh want another one?...&amp;nbsp; When attempting to populate a related record within a pop-up, in this case sewer ditchcard hyperlinks I know that I'm missing a section of code which specifies the field within the related table to populate from.&lt;/P&gt;&lt;P&gt;It might be worth noting FeatureSetByRelationshipName function is for one reason or another not available so I'm calling the table from $map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. var ServiceType = $feature;&lt;BR /&gt;2. if (Find('Sanitary', ServiceType, 0) &amp;gt; 0);&lt;BR /&gt;3. var Hyperlink = '&lt;A href="https://asbuilts.ci.missoula.mt.us/scards/" target="_blank"&gt;https://asbuilts.ci.missoula.mt.us/scards/&lt;/A&gt;' + FeatureSetByName($map,"Ditch Card Links - ConnectionTEST - Connection Data Table") &lt;EM&gt;&lt;STRONG&gt;MISSING FIELD FUNCTION&lt;/STRONG&gt;&lt;/EM&gt; + '.pdf'&lt;BR /&gt;4. return Hyperlink&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_0-1630365289359.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22048iF8C19542E18ECD38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_0-1630365289359.png" alt="JohnDriessen_0-1630365289359.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_1-1630365331774.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22049iC9E49F34340FC381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_1-1630365331774.png" alt="JohnDriessen_1-1630365331774.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_2-1630365369551.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22050iC929EF69822D4B3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_2-1630365369551.png" alt="JohnDriessen_2-1630365369551.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>Mon, 30 Aug 2021 23:16:25 GMT</pubDate>
    <dc:creator>JohnDriessen</dc:creator>
    <dc:date>2021-08-30T23:16:25Z</dc:date>
    <item>
      <title>Arcade Pop-Up.  First two functions work, while third fails.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1092869#M1032</link>
      <description>&lt;P&gt;Hi folks, thanks for any assistance you can offer.&amp;nbsp; Being somewhat new to Arcade I'm sure this is an amateur mistake.&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp; The first two lines of code work as they should.&amp;nbsp; An IFF statement to remove blank fields, followed by a prefix and suffix added to a field, creating a hyperlink.&lt;/P&gt;&lt;P&gt;Some of the fields (in this case ASBUILTS) need to be removed.&amp;nbsp; I've parsed those out and have a list of 30 which the find and replace with "" will run on.&lt;/P&gt;&lt;P&gt;//works&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var ASBUILT = IIF(isEmpty($feature.AsBuiltFileName), "",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"&lt;A href="https://asbuilts.ci.missoula.mt.us/water/" target="_blank" rel="noopener"&gt;https://asbuilts.ci.missoula.mt.us/water/&lt;/A&gt;" + $feature.AsBuiltFileName + ".pdf")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Replace(ASBUILT,"&lt;A href="https://asbuilts.ci.missoula.mt.us/water/HH2-A.pdf" target="_blank" rel="noopener"&gt;https://asbuilts.ci.missoula.mt.us/water/HH2-A.pdf&lt;/A&gt;","")&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;//doesn't work&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var ASBUILT = IIF(isEmpty($feature.AsBuiltFileName), "",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"&lt;A href="https://asbuilts.ci.missoula.mt.us/water/" target="_blank" rel="noopener"&gt;https://asbuilts.ci.missoula.mt.us/water/&lt;/A&gt;" + $feature.AsBuiltFileName + ".pdf")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Replace(ASBUILT,"&lt;A href="https://asbuilts.ci.missoula.mt.us/water/HH2-A.pdf" target="_blank" rel="noopener"&gt;https://asbuilts.ci.missoula.mt.us/water/HH2-A.pdf&lt;/A&gt;","")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;U&gt;Replace(ASBUILT,"&lt;A href="https://asbuilts.ci.missoula.mt.us/water/010-A.pdf" target="_blank" rel="noopener"&gt;https://asbuilts.ci.missoula.mt.us/water/010-A.pdf&lt;/A&gt;","")&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 19:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1092869#M1032</guid>
      <dc:creator>JohnDriessen</dc:creator>
      <dc:date>2021-08-26T19:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Pop-Up.  First two functions work, while third fails.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1092892#M1033</link>
      <description>&lt;P&gt;If I'm understanding this correctly, you have a list of 30 values that should be removed?&lt;/P&gt;&lt;P&gt;While I can't be sure exactly why your code isn't working, you should know that the &lt;STRONG&gt;Replace&lt;/STRONG&gt; function returns a string. Without assigning the results of that function to a variable, Arcade is going to treat that as having an &lt;EM&gt;implicit return&lt;/EM&gt;. Meaning, it will read that function as providing the output of your full expression. This applies specifically when it's the final line of your expression.&lt;/P&gt;&lt;P&gt;In any case, those multiple Replace functions won't be doing what you think they will, and it's not the best approach.&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Establish a list of values to exclude&lt;/LI&gt;&lt;LI&gt;Check if your field is empty&lt;/LI&gt;&lt;LI&gt;If it is &lt;EM&gt;not &lt;/EM&gt;empty, check if it's in the "excluded" list&lt;/LI&gt;&lt;LI&gt;If it's not in that list, assemble the string and return it.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This has the benefit of not needing to do a series of find/replace functions when the field is empty. If the field is empty, or it's in the exclude list, the expression simply stops there and doesn't return anything. Here's the code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// List of items to exclude
var excluded = [
    'a',
    'list',
    'of',
    'values',
    'to',
    'exclude'
]

var asbuilt = $feature.AsBuiltFileName

var urlstart = 'https://asbuilts.ci.missoula.mt.us/water/'

// Check if not empty
if(!IsEmpty(asbuilt)){
    // Check if excluded
    if(!Includes(excluded, asbuilt)){
        return `${urlstart + asbuilt}.pdf`
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's me testing it against a couple of static values and a null value.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1630008307639.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21842i61FFEAD2BEE8B412/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1630008307639.png" alt="jcarlson_0-1630008307639.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1630008337571.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21843iE4139B3256E91375/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1630008337571.png" alt="jcarlson_1-1630008337571.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_2-1630008353720.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21844i7ECFADB7C1C23129/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_2-1630008353720.png" alt="jcarlson_2-1630008353720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1092892#M1033</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-08-26T20:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Pop-Up.  First two functions work, while third fails.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093169#M1034</link>
      <description>&lt;P&gt;Josh thank you so much your solution worked seamlessly!&amp;nbsp; I may have to reach-out to you later today with yet another quandary regarding displaying related table attribute fields within a pop-up attribute expression.&amp;nbsp; If you have a favorite brewery nearby I'd be happy to buy you a beer.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 16:01:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093169#M1034</guid>
      <dc:creator>JohnDriessen</dc:creator>
      <dc:date>2021-08-27T16:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Pop-Up.  First two functions work, while third fails.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093205#M1035</link>
      <description>&lt;P&gt;You're very welcome! I'll keep an eye out for future posts. Related attributes in a popup is a popular topic here, so I'd be surprised if there wasn't something on here already that might help you there.&lt;/P&gt;&lt;P&gt;Cheers! &lt;span class="lia-unicode-emoji" title=":clinking_beer_mugs:"&gt;🍻&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 16:55:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093205#M1035</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-08-27T16:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Pop-Up.  First two functions work, while third fails.</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093856#M1036</link>
      <description>&lt;P&gt;Josh want another one?...&amp;nbsp; When attempting to populate a related record within a pop-up, in this case sewer ditchcard hyperlinks I know that I'm missing a section of code which specifies the field within the related table to populate from.&lt;/P&gt;&lt;P&gt;It might be worth noting FeatureSetByRelationshipName function is for one reason or another not available so I'm calling the table from $map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. var ServiceType = $feature;&lt;BR /&gt;2. if (Find('Sanitary', ServiceType, 0) &amp;gt; 0);&lt;BR /&gt;3. var Hyperlink = '&lt;A href="https://asbuilts.ci.missoula.mt.us/scards/" target="_blank"&gt;https://asbuilts.ci.missoula.mt.us/scards/&lt;/A&gt;' + FeatureSetByName($map,"Ditch Card Links - ConnectionTEST - Connection Data Table") &lt;EM&gt;&lt;STRONG&gt;MISSING FIELD FUNCTION&lt;/STRONG&gt;&lt;/EM&gt; + '.pdf'&lt;BR /&gt;4. return Hyperlink&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_0-1630365289359.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22048iF8C19542E18ECD38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_0-1630365289359.png" alt="JohnDriessen_0-1630365289359.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_1-1630365331774.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22049iC9E49F34340FC381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_1-1630365331774.png" alt="JohnDriessen_1-1630365331774.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnDriessen_2-1630365369551.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22050iC929EF69822D4B3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnDriessen_2-1630365369551.png" alt="JohnDriessen_2-1630365369551.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>Mon, 30 Aug 2021 23:16:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-pop-up-first-two-functions-work-while-third/m-p/1093856#M1036</guid>
      <dc:creator>JohnDriessen</dc:creator>
      <dc:date>2021-08-30T23:16:25Z</dc:date>
    </item>
  </channel>
</rss>

