Apply Report Operations
apply_report_operationsBuild or modify SAS Visual Analytics reports by applying an ordered, atomic batch of operations to add pages, objects, parameters, and change data sources. Validates all before writing.
Instructions
Apply an ordered batch of operations to a report — the authoring workhorse.
This is how you add pages, add objects (any of the ~60 VA visual, control,
and content types), set parameters, and swap data sources. operations
is the native SAS Visual Analytics operations array; the whole batch is
applied atomically (all succeed or nothing changes).
Operation keys (one per array element): addData, addPage,
addObject, updateObject, setParameterValue, updateData,
changeData, applyDataView. Call describe_report_objects for
each operation's shape (operation="addData" covers formats,
aggregations, and geography via dataItems) and each object's data
roles, and get_castable_columns to map columns onto those roles.
Layout & titles (see describe_report_objects → placement /
layout_recipes for details):
Page title — give
addPageatitle(e.g.{"addPage": {"pageName": "Overview", "title": "Sales Overview"}}); it becomes a text band at the top of that page's body. Page/report headers accept ONLY control objects — never text or visuals.Chart titles — pass
{"options": {"object": {"title": "..."}}}inside the object spec at add time (all types exceptstandardContainer, which takes no options at add time).One-batch multi-page — create pages inline with placement
{"report": {"context": "new_page", "pageName": "Trends", "pagePosition": 1}}(numeric position) and target that pageName from later operations in the same batch.Grids/columns —
relativeToObjectwithleft/right/top/bottom(geometric) orbefore/after(flow order) against an EXISTING object's name; same-batch forward references fail, so chain across calls using the names each result returns. Objects are auto-named and auto-sized; placement and dataRoles are write-once (updateObjectchanges options only).Read structure back anytime with
get_report_outline; verify visually withexport_reportpage-by-page (seeverify_hintin the result).
The tool validates every operation against the object catalog before any HTTP call (unknown/typo'd object type, non-addable object, bad data-role names or arity, disallowed object/placement keys) and reports ALL invalid operations at once. It also handles the ETag optimistic-concurrency handshake for you, retrying once transparently on a concurrent edit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | Validate and return the normalized payload (plus any soft warnings about missing common roles) without writing anything. | |
| save_as | No | False (default) edits the report in place. True applies the operations to a NEW report instead, leaving the source untouched (atomic template instantiation; pairs with ``changeData``), named by ``result_report_name`` and/or placed by ``result_folder`` — at least one is required. This flag alone decides the mode: a ``result_report_name`` or ``result_folder`` given while it is False is refused rather than acted on, so the source can never be edited or cloned by surprise. Blank values count as not given. | |
| report_id | Yes | Target report id (from ``create_report`` or ``list_reports``). | |
| operations | Yes | Ordered native operations array. Example element: ``{"addObject": {"object": {"barChart": {"dataSource": "CARS", "dataRoles": {"category": "Origin", "measures": ["MSRP"]}, "options": {"object": {"title": "MSRP by Origin"}}}}, "placement": {"page": {"target": "Overview"}}}}``. | |
| result_folder | No | Save-as target folder URI; omit for My Folder. | |
| response_format | No | ``concise`` (default) returns the created page/object/ data-source names+labels; ``detailed`` also echoes the full VA response. | concise |
| result_report_name | No | Save-as name for the new report. | |
| result_name_conflict | No | Save-as name-conflict policy — ``rename`` (default), ``abort``, or ``replace``. | rename |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||