---
title: "Arcade Expressions for Layer Links"
canonical: "https://help.cartinuum.com/space/GC1/4272259074/Arcade%20Expressions%20for%20Layer%20Links"
format: markdown
---
### **Custom Layouts with Arcade Expressions for Layer Links**

## **Overview**

The **Layer Link** feature in Connect for ArcGIS lets you pull business system data directly into your ArcGIS Experience Builder apps.

By default, returned data is displayed as simple **“label: value”** pairs in a table. Now, you can go further—with **Arcade Expressions** that let you fully control the layout and presentation using **custom HTML output**.

With **Arcade Expression support**, you can:

- Design rich, custom layouts for Layer Link results
- Use HTML tags for full control over formatting
- Build dynamic, context-aware outputs (e.g., show/hide content, insert images, apply styling)

![image-20260114-045813.png](media://08e90cb3-5fe0-404c-9ce5-488321bc2ba7)

> ℹ️ The Arcade Expression used to generate this example can be found at the end of this article.

---

## **How It Works**

1. **Enable Arcade Expression Mode**

In Experience Builder, select the Connect for ArcGIS widget and open the Layer configuration in the properties panel.

Select the Layer Link or Feature Attributes and choose **Arcade expression**.

![image-20260114-045932.png](media://895ec143-c950-4933-a395-86ad75d830cf)


2. **Write Your Expression**

Click on the Expression link to open the Arcade Editor to define your output.

Your expression must return a string containing value HTML.

- You can reference any field returned by the Layer Link using the syntax:

`$layerlink.<label>,` for example: `$layerlink.asset_type`. Click on the `(x)` button and select `$layerlink` to see a list of available variables.

![image-20260114-050154.png](media://5904f843-1b5f-488f-a4fc-6fa66a2ed747)

- You can also include attribute values from the selected map feature using `$feature`.
- Use standard HTML tags (`<div>`, `<table>` etc), as well as styles, classes to define your layout.

Example: 

```none
return `
  <div><strong>Name:</strong> ${$layerlink.name}</div>
  <div><strong>Status:</strong> ${$layerlink.status}</div>
`
```

3. **Test Your Arcade Expression**

Click the **Run** button to test your expression.

The result of the expression will be shown in the output panel.

Once you are happy it’s working as expected, Save your expression.

![image-20260114-050405.png](media://5d47531c-dd1e-4d41-9809-60956e171df2)


4. **Preview Your Output**

After saving your Arcade expression:

- Select feature(s) on your map.
- You’ll see the custom HTML layout rendered in place of the standard results table.

![image-20260114-045813.png](media://08e90cb3-5fe0-404c-9ce5-488321bc2ba7)

---

## Tips & Best Practice

- Ensure you return **valid HTML** to avoid rendering issues.
- Use CSS inline styles or classes to style your layout.
- Handle missing values gracefully using `IIf(IsEmpty(...), "N/A", ...)` or similar.
- For advanced users: embed icons, images, or hyperlinks dynamically using returned values.
- Beware of inherited CSS styles. You may need to add the `white-space:initial` style to your outer `DIV` to prevent Experience Builder rendering new lines and other white space from your HTML.
- Save your application regularly to avoid losing your work!

> ✅ AI agents are great at building your HTML output. Many agents can generate the Arcade Expression from a screenshot of your LayerLink table view and a pencil sketch of your desired layout!

---

## When to Use This

Use Arcade Expressions with Layer Links when you want to:

- Show **business system data** in a specific format
- Highlight key values with visual styling
- Build a more polished or brand-aligned UI
- Avoid the limitations of simple tabular display

---

## Video Walkthrough

![GVC Arcade Expressions.mp4](media://9dd61836-47ea-4dea-97b0-74a03023cfc0)


---

## Sample Arcade Expression

This extreme example shows the code that was used to generate the sample layout shown in this article. The Arcade Expression includes some interesting snippets that you might want to use in your expressions.

- Convert dates to friendly format using the `fmtDate()` function.
- Convert currency to friendly format using the `fmtCurrency()` function.
- Using fallback text in place of any `null` values returned using the `nz()` function.

```
// Helper Functions
function nz(v, fallback) {
  return IIf(IsEmpty(v) || v == null, fallback, v)
}
function num(v) {
  return IIf(IsEmpty(v) || v == null, null, Number(v))
}
function fmtCurrency(n) {
  return IIf(n == null || IsNaN(n), '-', '$' + Text(n, '#,###,###,##0'))
}
function fmtArea(n) {
  return IIf(n == null || IsNaN(n), '-', Text(n, '#,###,###,##0.##') + ' m²')
}
function fmtDate(d) {
  return IIf(IsEmpty(d) || d == null, '-', Text(Date(d), 'D MMM YYYY'))
}
function fmtDateTime(d) {
  return IIf(IsEmpty(d) || d == null, '-', Text(Date(d), 'D MMM YYYY h:mm A'))
}
function fmtPhone(p) {
  return Replace(p, '+61', '0') // Numbers start with +61
}

// Store formatted $layerlink values into local variables
var assessed = num($layerlink.assessedvalue__c)
var lotSize = num($layerlink.lotsize__c)

var name = nz($layerlink.name, '')
var street = nz($layerlink.street__c, '')
var city = nz($layerlink.city__c, '')
var state = nz($layerlink.state__c, '')
var postcode = nz($layerlink.postalcode__c, '')

var owner = nz($layerlink.ownername__c, '-')
var phone = fmtPhone($layerlink.phone_number__c)

var propertyType = nz($layerlink.propertytype__c, '-')
var scheme = nz($layerlink.planningscheme__c, '-')

var dateBuilt = fmtDate($layerlink.datebuilt__c)
var lastMod = fmtDateTime($layerlink.lastmodifieddate)

var line1 = Trim(name)
var line2 = Trim(street)
var line3 = Trim(Concatenate(state, ' ', postcode))

var addressBlock = Concatenate(
  IIf(line1 != '', `<div style="font-weight:700; font-size:14px;">${line1}</div>`, ''),
  IIf(line3 != '', `<div>${line3}</div>`, '')
)

// Build the return value.
return
`<div style="
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255,255,255,0.95);
  white-space:initial;
">

  <!-- Top row: Address + Value card -->
  <div style="display:flex; gap:14px; align-items:stretch; justify-content:space-between;">
    <div style="flex: 1 1 auto; min-width: 0;">
      <div style="margin-bottom: 10px;">
        ${addressBlock}
      </div>

      <div style="
        border-top: 1px solid rgba(0,0,0,0.08);
        padding-top: 10px;
        color: rgba(0,0,0,0.78);
      ">
        <div style="margin-bottom: 6px;">
          <span style="display:inline-block; width: 62px; color: rgba(0,0,0,0.55); font-size: 12px;">Owner</span>
          <span style="font-weight: 600; color: rgba(0,0,0,0.88); display: block;">${owner}</span>
        </div>
        <div>
          <span style="display:inline-block; width: 62px; color: rgba(0,0,0,0.55); font-size: 12px;">Phone</span>
          <span style="font-weight: 600; color: rgba(0,0,0,0.88); display: block;">${phone}</span>
        </div>
      </div>
    </div>

    <div style="
      flex: 0 0 170px;
      border-radius: 12px;
      background: rgba(0,0,0,0.045);
      padding: 12px;
      text-align: right;
      display:flex;
      flex-direction: column;
      justify-content: center;
    ">
      <div style="
        font-size: 11px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(0,0,0,0.55);
        margin-bottom: 8px;
      ">Assessed value</div>

      <div style="
        font-size: 22px;
        font-weight: 900;
        color: ${$theme.dark};
        line-height: 1.1;
        margin-bottom: 10px;
      ">${fmtCurrency(assessed)}</div>

      <div style="
        font-size: 12px;
        color: rgba(0,0,0,0.70);
      ">
        <span style="color: rgba(0,0,0,0.55);">Lot</span>: ${fmtArea(lotSize)}
      </div>
    </div>
  </div>

  <!-- Bottom details -->
  <div style="margin-top: 14px; border-top: 1px solid rgba(0,0,0,0.10); padding-top: 12px;">
    <table style="width:100%; border-collapse: collapse; table-layout: fixed;">
      <tr>
        <td style="vertical-align: top; padding: 0 10px 10px 0;">
          <div style="font-size: 12px; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.04em;">Property type</div>
          <div style="font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.88);">${propertyType}</div>
        </td>
        <td style="vertical-align: top; padding: 0 0 10px 10px;">
          <div style="font-size: 12px; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.04em;">Planning scheme</div>
          <div style="font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.88);">${scheme}</div>
        </td>
      </tr>
      <tr>
        <td style="vertical-align: top; padding: 0 10px 0 0;">
          <div style="font-size: 12px; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.04em;">Date built</div>
          <div style="font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.88);">${dateBuilt}</div>
        </td>
        <td style="vertical-align: top; padding: 0 0 0 10px;">
          <div style="font-size: 12px; color: rgba(0,0,0,0.55); text-transform: uppercase; letter-spacing: 0.04em;">Last modified</div>
          <div style="font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.88);">${lastMod}</div>
        </td>
      </tr>
    </table>
  </div>

</div>`
```