Select to view content in your preferred language

Arcade Expression Help-Conditional Table

3738
10
Jump to solution
04-28-2018 10:31 PM
SteveCole
Honored Contributor

I'm having trouble implementing what I want as a popup for a point layer. The points represent physical locations and basically store URLs to photos and video of the location. There are five photo URLfields (photo01, photo02, photo03, photo4, photo5) and five video URL fields (video01, video02, video03, video04, video05).

A site may have UP TO 5 photos or videos or it may have none. Because of this, ideally I'd like the attributes to adjust accordingly. For example, if a site has no photos and 2 videos, the popup would look like this:

Photos:

No Photos currently. Please Check back

Video:

Video 01: <url>

Video 02: <url>

I have some expressions which help me determine if the field is empty but I can't figure out how to incorporate that into a dynamic table in the popup.

Here'e the actual service layer link.

Any ideas?

Steve

0 Kudos
10 Replies
SteveCole
Honored Contributor

I had to do way to much work to get this work but I guess this will be as close as I'm able to get to what I want:

One glaring deficiency of using Arcade (for me, at least) is that any output that the Arcade Expression generates that includes HTML tag elements is NOT honored by the configuration screen. It simply passes it along as text. As such, for each row of my screen shot above, I needed to use two expressions- one for the actual URL of the link, and a second expression for the "Click to View" text of the <a> element. For both expressions, I simply used the IIF that Ken suggested based on the Find function.

The final config HTML was this:

<table cellpadding="0px" cellspacing="3px">
<tbody>
<tr valign="top">
<td colspan="2"><b>SITE: </b>{unitName}<br /> <b><u><br />PHOTOS:</u></b></td>
<td> </td>
</tr>
<tr valign="top">
<td><b>Photo 1:</b></td>
<td><a href="{expression/expr8}" target="_blank">{expression/expr18}</a></td>
</tr>
<tr valign="top">
<td><b>Photo 2:</b></td>
<td><a href="{expression/expr9}" target="_blank">{expression/expr19}</a></td>
</tr>
<tr valign="top">
<td><b>Photo 3:</b></td>
<td><a href="{expression/expr10}" target="_blank">{expression/expr20}</a></td>
</tr>
<tr valign="top">
<td><b>Photo 4:</b></td>
<td><a href="{expression/expr11}" target="_blank">{expression/expr21}</a></td>
</tr>
<tr valign="top">
<td><b>Photo 5:</b></td>
<td><a href="{expression/expr12}" target="_blank">{expression/expr22}</a></td>
</tr>
<tr valign="top">
<td colspan="2"><b><u>VIDEOS:</u></b></td>
<td> </td>
</tr>
<tr valign="top">
<td><b>Video 1:</b></td>
<td><a href="{expression/expr13}" target="_blank">{expression/expr23}</a></td>
</tr>
<tr valign="top">
<td><b>Video 2:</b></td>
<td><a href="{expression/expr14}" target="_blank">{expression/expr24}</a></td>
</tr>
<tr valign="top">
<td><b>Video 3:</b></td>
<td><a href="{expression/expr15}" target="_blank">{expression/expr25}</a></td>
</tr>
<tr valign="top">
<td><b>Video 4:</b></td>
<td><a href="{expression/expr16}" target="_blank">{expression/expr26}</a></td>
</tr>
<tr valign="top">
<td><b>Video 5:</b></td>
<td><a href="{expression/expr17}" target="_blank">{expression/expr27}</a></td>
</tr>
</tbody>
</table><br /><i>(Links Open in a New Window</i> )

Thanks everyone.