Skip to content

The Code view ​

Code, in the designer's top strip between Versions and Export (and in the More menu), opens the report beside the pages as text: as JSON, or in RFML's markup notation (RFML §27). The switch at its top picks the notation, and the browser remembers it. A component opened in its own scope shows its definition as JSON: its description, props, slots and template. Drag the view's left edge to make it wider (panels.md).

Editing the text ​

What you type is checked as you type, and problems are underlined where they are, with the document's own diagnostics. It goes into the report when the text loses the focus, on Apply or Ctrl+S (⌘S on macOS, which saves too), and before a publish, an export or a preview, when the view closes or you leave the page. Then the text is rewritten in RFML's canonical form. Each apply is one undo step, checked as any edit is, so locks hold and an edit that adds errors isn't applied: the view says why.

A change made on the canvas, in the outline or with Undo shows in the text, unless the text holds edits that aren't applied yet; then the view says so, and offers to discard them. Moving the cursor selects the node around it on the canvas and in the outline, and a node selected there is highlighted in the text.

Suggestions as you type ​

The view knows the RFML of the Report Server it is open on, so what it suggests is what that server reads.

In markup:

  • Elements. After <, the elements that may go there. Picking one writes the whole element with what it needs: a repeat comes with its <detail>.
  • Attributes and their values. An attribute's values are listed where it has a set of them. Where an attribute names something, its values are the names the report and its linked libraries have: classes in class="…", components, page templates, images, node ids, and tokens as var(--…). The document's RFML version offers the versions the server reads.
  • Styles. In style="…" and in the <styles> block, property names, then their values: keywords, the theme's tokens first for colours and lengths (with a swatch for a colour), and the document's font families for font-family. These open as you type; elsewhere, suggestions wait for <, a space, a quote, /, . or (, or Ctrl+Space.
  • Expressions. Inside {{ … }} and in attributes that hold an expression (source, if, value and the others), the fields of the report's data, its parameters and variables, and the functions, with each function's arguments as you type them.
  • Hover over an element, an attribute or a style property to see what it is, and over a field or a function in an expression to see its type.

In JSON, the view completes keys and values from the RFML schema, describes them on hover, and marks what doesn't fit the schema as a warning. Expressions in its strings get the same suggestions as in markup.

Going to a name, and renaming it ​

In markup, the names the text defines can be followed:

KeyDoes
F12, or Ctrl+F12 where the browser keeps F12Go to the definition of the class, token, dataset, variable, parameter, component, image or page template under the cursor
Alt+F12Peek at the definition without leaving the place
Shift+F12Find its uses
F2Rename a class or a token the text defines, with every use of it

The same are in the right-click menu. A class or token that comes from a linked library has no definition in the text, and isn't renamed there: change it in the library (libraries.md).

The right-click menu ​

Beside Cut, Copy and Paste and the commands above, the menu has:

ItemOnDoes
Wrap in a box (Ctrl+G)An element with an idPuts the element in a new box
Unwrap (Ctrl+Shift+G)An element with an idPuts a box's children in its place
Remove elementAn element with an idDeletes it
Add noteAn element, in markupWrites a comment before it, its note (RFML §27), with the word Note selected to type over; on an element that has one, selects it
Show in Datadata.…, params.… or vars.… in an expressionShows the field in the Data panel
Show class in ThemeA class nameShows the class in the Theme tab

Wrap, Unwrap and Remove run the designer's own commands, so locks, permissions and undo are as on the canvas. They are offered while the text holds no edits that aren't applied yet, and the text then shows the result.

JSON fields elsewhere in the studio ​

The studio's other JSON fields use the same editor once you click in them: a dataset's schema in the Data panel, the New report wizard's sample data and schema, a data source's query, body, schema and sample, and the Inspector's JSON properties. Each checks what you type against its JSON schema: a sample against the dataset's schema, a schema against JSON Schema itself.

The Libraries page has a Code view of its own, for a library's files (libraries.md).