Files
docs.datacontroller.io/docs/embed-va.md
T
dc c7626b2797 docs(developer): a page for the browser variables, and links from where they are used
browser_info and browser_url_vars were only described inside the troubleshooting
page, under Support Diagnostics. That is the right place to find them if you
already know they exist and are looking for a log line; it is not where anyone
looks when writing a hook, which is what they are mostly for.

The new Developer Guide page carries the whole subject: which services receive
the two tables, the column lists, the debug values per platform and the MPEINIT
log lines, reading them from a hook with the exist() guard, and the reminder that
they are client-supplied and so diagnostics rather than a security boundary.

Troubleshooting keeps three stub headings - browser_info, browser_url_vars,
reading-them-from-a-hook - pointing at the page, so the anchors that are already
published keep resolving, and the detail is not maintained twice.

Linked from the three places a hook author actually starts: the HOOK Scripts
section of the MPE_TABLES page, the pre-edit hook guide (where the editor's
inputs are listed), the two-rule-sets guide (post-edit hook), and the VA embed
page, where embed=va is exactly the kind of thing a hook wants to branch on.
2026-10-26 11:42:35 +00:00

62 lines
3.2 KiB
Markdown

---
layout: article
title: SAS Visual Analytics Embed
description: Embed the Data Controller editor inside a SAS VA report as a data-driven content object. Row selections in the VA report drive filters and column visibility in the editor.
---
# Embedding inside SAS Visual Analytics
Data Controller can be embedded inside a SAS Visual Analytics report as a **data-driven content** (DDC) object. This unlocks scenarios where a user can safely modify the values in an underlying SAS table, and have the visualisation updated- all from inside the same report.
## URL
Open the editor as a DDC by appending `?embed=va` to the editor route:
```
`https://yourserver/DC/#/editor/<library>/<table>?embed=va`
```
The `?embed=` parameter accepts three values:
| Value | Behaviour |
|---|---|
| `true` | Chrome (header, back button, sub-nav) is hidden. Editor functions normally. |
| `va` | Same chrome-hiding as `true`, **plus** editor becomes "VA-aware" - any report filters are captured, and columns can be displayed / hidden using the Edit Report interface. Filter button is disabled (use VA filters instead)|
| `false` (or omitted) | Standard interactive UI. |
## How VA drives the editor
VA pushes a JSON payload to the iframe via `window.postMessage` whenever the selected rows change. Data Controller listens for these messages and:
1. Resolves each VA `parameter` to a DC column by matching on column label.
2. Builds a filter (using existing [Filter](/filter/) machinery) over the selected values.
3. Hides any VA columns marked as `brush` so the grid stays focused on the user-editable columns (except primary key cols which are always shown)
If VA sends an empty / unmatched message the editor falls back to the unfiltered view but stays in VA mode.
More logic available in [`va-messaging.service.ts'](https://git.datacontroller.io/dc/dc/src/branch/main/client/src/app/services/va-messaging.service.ts).
## Filter Modes
When running in `embed=va` mode, the editor provides two filter modes, controlled by the **Auto-apply** checkbox:
* **Live (default)** - the editor updates automatically as you select rows in the VA report, so the data you see always matches your current selection.
* **Confirm** - filter changes are held until you click the **Apply** button. This is useful when editing, where an automatic reload would discard unsaved changes.
A status indicator shows whether a filter change is pending, loading, or idle. In edit mode, a pending filter is held until you leave edit mode, so your unsaved edits are never lost.
## Configuration in VA
In the VA Report Designer, add a **Data-Driven Content** object and set the URL to the editor route shown above. Be sure that any report level filters have their corresponding parameters added to the DDC object itself.
## Debugging
A hook script can tell an embedded editor from a standalone one without any client-side inspection: `work.browser_info` carries the page URL and `referrer`, and `work.browser_url_vars` carries `embed=va`. See [Browser Variables](/developer-guide/browser-variables/).
The following snippet can be used in console to dump the values being provided to DC from VA:
```
console.log(JSON.stringify(window.__vaLastMessage?.data, null, 2))
```