Skip to content

Dynamic Tables with Scriban

Error messages in DAQS support static {{placeholder}} values — but sometimes an element fails because of multiple issues at once, and a single value is not enough to communicate that clearly.

For those cases, DAQS supports Scriban template syntax to generate dynamic tables inside error messages.


What Scriban is

Scriban is a lightweight template language. In DAQS error messages, it is used to loop over arrays in the filter output and render them as Markdown tables.

The filter returns an array field. The error message uses a for loop to render each item as a table row.


Basic syntax

| Column header |
|---|
[[~ for $item in {{arrayField}} ~]]
| [[ $item ]] |
[[~ end ~]]
  • [[~ ... ~]] — Scriban block tag (whitespace-trimming variant)
  • [[ $item ]] — renders the value of the current loop variable
  • {{arrayField}} — the array field from the filter output

Example — list of missing parameters

Filter output for one element:

{
  "id": 616521,
  "name": "1018x2387",
  "missingParams": ["Fire Rating", "Assembly Code", "Type Mark"]
}

Error message:

#### Issue

The element **{{name}}** is missing required parameters.

| Missing parameter |
|---|
[[~ for $p in {{missingParams}} ~]]
| **`[[ $p ]]`** |
[[~ end ~]]

---

#### Solution

Open the element in Revit and fill in all missing parameters listed above.

---

#### Explanation

These parameters are required for correct classification and downstream use.

The rendered output in the plugin shows a table with one row per missing parameter.


Example — list of allowed values

| Allowed category |
|---|
[[~ for $c in {{allowedCategories}} ~]]
| [[ $c ]] |
[[~ end ~]]

What the filter must return

For Scriban loops to work, the filter must return the field as a JSON array:

{
  "id": id,
  "name": name,
  "missingParams": [
    "Fire Rating",
    "Assembly Code"
  ]
}

A single string value cannot be looped over. If the field is not an array, the loop produces no output.


When to use Scriban

Use Scriban tables when:

  • An element can fail for multiple reasons of the same type
  • The number of failing items varies per element
  • A static list in the error message would be incomplete or misleading

Do not use it when a single {{placeholder}} is sufficient. Scriban adds visual complexity — earn it.