Skip to content

Writing Rules

This chapter brings everything together: filter, validation, error message, and rule description — composed into a complete, publishable DAQS rule.

A rule is only complete when a user in the Revit plugin can read the error message and know exactly what is wrong and how to fix it.


What you will learn

By the end of this chapter, you will be able to:

  • Understand the full anatomy of a DAQS rule
  • Write a clear rule description that explains scope and purpose
  • Configure selectors and GUIDs correctly
  • Connect validations to filter output
  • Write error messages that are actionable and consistent
  • Use {{placeholders}} from filter output in error messages
  • Build dynamic tables in error messages using Scriban

How this chapter is structured

Rule Anatomy

A complete breakdown of every field in a DAQS rule — what each part does and why it exists.

Rule Description Template

The standard template for describing a rule: what it checks, which elements it applies to, and why the rule exists. Every published rule must follow this structure.

Selectors and GUIDs

How to identify which rule configuration is used and how GUIDs link rules to Revit elements.

Validations

How to wire the validator to the filter output inside a complete rule definition.

Error Messages

How error messages reach the user in the Revit plugin and what makes them effective.

Error Message Structure

Every DAQS error message must follow a fixed structure:

#### Issue
#### Solution
#### Explanation

Using Filter Output in Error Messages

Any field returned by the JSONata filter can be used in the error message with {{fieldName}} syntax. Double curly braces are mandatory.

Collection Error Messages

How to write error messages for validations that report on a group of elements rather than one at a time.

Dynamic Tables with Scriban

How to use Scriban template syntax to build dynamic tables in error messages — for example, listing all missing parameters or all invalid values in a formatted table.

Online Help

How to link a rule to online documentation that users can open directly from the plugin.


Prerequisites

Complete Filters and Validating first.


Where to go next

👉 Debugging and Testing