05. Reference
Exact answers: every recipe setting, template tag, number style, command-line option and exit code. For a guided path, see 02 Your first report.
Contents: 1 Recipe skeleton · 2 Summary tables · 3 Cross-tabs · 4 Grouped layouts · 4a Label sheets · 5 Totals · 6 Charts · 6a Barcodes · 7 Number formats · 8 Highlight rules · 9 Formulas · 10 Parameters and filters · 11 Sub-report links · 12 Template tags · 13 Command line · 14 Report jobs · 15 Error messages · 16 Limits
1. Recipe skeleton
A recipe is one text file in JSON format, with schemaVersion: 1. Name it <template-name>.recipe.json. Unknown keys are
errors.
{
"schemaVersion": 1,
"name": "Customer statement",
"recordKey": "Customer",
"parameters": { },
"filters": [ ],
"links": { },
"tables": { },
"totals": { },
"charts": { },
"barcodes": { }
}
| Key | Required | What it is |
|---|---|---|
schemaVersion |
yes | Always 1 |
name |
no | A label. Shown on the screen and used for the download's file name |
recordKey |
no, but almost always | The column that defines records: one document per distinct value, in order of first appearance. Other columns (Email, and so on) come from the first row with that key. Without it, each data row is a record and per-record tables are not attached |
parameters |
no | Values asked for before a run (section 10) |
filters |
no | Rules that keep some rows, usually from a parameter (section 10) |
links |
no | Lets a second table name the record key differently (section 11) |
computed |
no | New columns worked out for every row of a table, before anything else (section 9) |
tables |
no | Summary tables, cross-tabs, grouped layouts and label sheets |
totals |
no | Single numbers |
keepRecords |
no | Skip records (no document) whose per-record total fails every condition: [ { "total": "CustomerTotal", "when": "gte", "value": 2000 } ]. Needs recordKey and a perRecord total. Grand totals are unchanged |
charts |
no | Pictures drawn from summary tables |
barcodes |
no | A QR or Code 128 picture of a record's (or a label's) value (section 6a) |
Naming rules. A table, total, chart, barcode (Barcode_<Name>), parameter or calculated column must not share a name with a
data column. The checker rejects collisions, and for a parameter it looks at every table the report loads. In a recipe,
tables are called by their file name without .csv (transactions). On the screen, they use the table name shown.
2. Summary tables: groupBy + measures
"ByMonth": {
"from": "transactions",
"groupBy": ["Customer", { "month": "Date", "as": "Month" }],
"measures": { "Total": { "sum": "Amount" } },
"running": [{ "of": "Total", "as": "Running" }],
"sort": ["Customer", "Month"],
"top": { "n": 5, "by": "Total" },
"format": "currency"
}
| Key | Meaning |
|---|---|
from |
The source table (required) |
groupBy |
A list of columns, or date buckets { "<bucket>": "<DateColumn>", "as": "<Name>" }. Buckets: day, week, month, quarter, halfYear, year, weekday (see "Date buckets" below) |
measures |
{ "Name": { "<function>": "<Column>" } }. Functions: sum, avg, min, max, count, first, last, and distinct, median, percentile, nthLargest, nthSmallest, mode, stdev, variance, weightedAvg (see "More summary functions" below). { "count": "*" } counts rows. first and last are the first and last number of the group in file order (for example the open and close of a month from daily prices). upCapture and downCapture compare a column with a benchmark column (see "Rank, neighbours and time-series columns") |
running |
[{ "of": "<measure>", "as": "<Name>" }]. A cumulative total. Restarts for each record, or use partitionBy |
derived |
Columns worked out down the rows in the order listed (sort first): moving averages, growth, drawdown, changes, volatility, RSI, MACD, and rank, previous, next and difference (see below) |
heikinAshi |
Heikin-Ashi candles: four new columns from open, high, low and close measures (see below) |
sort |
A list of columns. Use { "by": "Total", "descending": true } for reverse order |
top |
{ "n": 5, "by": "Total" }. Keeps the biggest n of the last groupBy column within each combination of the others, and rolls the rest into one row. "other": "Everything else" renames that row. "other": false leaves the rest out. The default label is Other |
having |
Keep only groups whose own numbers meet every condition: [ { "column": "Total", "when": "gt", "value": 1000 } ]. column is a measure. when is lt, lte, gt, gte, eq, ne, between (add "to"), blank or notBlank. It is applied before top, sort, running, derived and calculated, so they see only the groups kept. Running, derived, calculated and group columns cannot be tested. Totals are not changed by it, and a chart of the table draws only the kept groups, so the table can add up to less than GrandTotal |
format |
plain, number, currency or percent (section 7) |
rules |
Highlight rules (section 8) |
calculated |
Calculated columns (section 9) |
Dates are read in the usual forms: 2026-01-31 and 1/31/2026. A row whose date cannot be read is left out of a bucketed
table and reported once.
Date buckets (groupBy of a table or a layout): { "week": "Date", "as": "Week" }. Give exactly one bucket key plus as.
Every label is text that sorts correctly.
| Bucket | Label | Notes |
|---|---|---|
day |
2026-11-09 |
|
week |
2026-W46 |
ISO 8601: weeks start on Monday, and week 1 holds the year's first Thursday. The label carries the ISO year, not the calendar year: 2024-12-30 is 2025-W01 and 2021-01-03 is 2020-W53 |
month |
2026-11 |
|
quarter |
2026-Q4 |
|
halfYear |
2026-H1 (January to June), 2026-H2 |
|
year |
2026 |
|
weekday |
1-Mon, 2-Tue, ... 7-Sun |
Monday is 1. The number makes the days sort Monday to Sunday |
More summary functions (in measures, a layout's subtotals, totals and a cross-tab's value): the same form as sum,
{ "<function>": "<Column>" }, plus the extra key some of them take.
| Function | Example | Gives |
|---|---|---|
distinct |
{ "distinct": "Category" } |
The number of different non-blank values (numbers or text). A whole number |
median |
{ "median": "Amount" } |
The 50th percentile. With an even count, the mean of the two middle numbers |
percentile |
{ "percentile": "Amount", "p": 90 } |
The value at percent p, a number from 0 to 100. p is required |
nthLargest |
{ "nthLargest": "Amount", "n": 2 } |
The n-th biggest value. n is a whole number of 1 or more (required). Repeats count: the 2nd largest of 9, 9, 5 is 9. Blank when n is more than the number of values |
nthSmallest |
{ "nthSmallest": "Amount", "n": 2 } |
The n-th smallest, with the same rules |
mode |
{ "mode": "Amount" } |
The value that occurs most often (numbers only). When several tie, the lowest wins. When every value occurs once, it is the lowest value |
stdev |
{ "stdev": "Amount" } |
The sample standard deviation (divides by n - 1). Add "population": true to divide by n |
variance |
{ "variance": "Amount" } |
The sample variance. Add "population": true for the population variance |
weightedAvg |
{ "weightedAvg": "Price", "weights": "Quantity" } |
The total of value × weight divided by the total of the weights. weights is a column of the same table (required) |
- Percentile method. With the n numbers sorted, the rank is
p / 100 × (n - 1)counted from 0, and the answer is the straight-line interpolation between the two numbers either side of it. This is Excel'sPERCENTILE.INC. For 10, 20, 20, 30, 40 andp90 the rank is 3.6, between 30 and 40, so the answer is 36. The median is the 50th percentile. Other tools offer other methods: do not compare a percentile with another product's figure without checking which method it uses. - Extra keys (
p,n,population,weights) work only with their own function:'p' is only used with 'percentile', not 'sum'. - Text and blanks are skipped and reported once, as for
sum.distinctis the exception: it counts non-blank text. ForweightedAvg, a row where either the value or the weight is not a number is skipped and reported. - Too few values. A sample
stdevorvarianceof one number is blank (the population forms give 0.00). A weighted average whose weights add up to 0 is blank. - Empty groups. A group (or total) with no numbers shows
distinctas 0 and every other new function as blank, and a note says how many. - Written as a whole number for
distinct, and in the table'sformatfor the rest. Ahavingcondition tests the full-precision number. - Where they do not work: a layout's
runningkeeps the seven original functions. A cross-tab'stotalsis still only forsumandcount. stdevhere is a measure (one number per group). The derived operation"stdev": 20(below) is a rolling window down the rows.- These numbers are worked out by the recipe, before the merge. A template function cannot calculate them.
Numbers are shown with two decimals and rounded the same way {{SUM}} rounds, so a total equals {{SUM:Table.Field}}. Blanks
and text in a number column are skipped with a warning (exit 5 on the command line).
In the template: {{ForEach:ByMonth}} <<Month>> <<Total>> <<Running>> {{EndForEach}}. The rows are the ones for this record.
Rank, neighbours and time-series columns
These are derived columns. The moving averages, drawdown, RSI and MACD are for finance and time-series work, and most reports do not need them.
Derived columns ("derived"): each is { "of": "<measure or running total>", "as": "<Name>", "<operation>": ... }, with
exactly one operation. Like a running total they restart for each record (or use partitionBy), follow the order of the rows
after sort, can be charted, highlighted and used in the template, and cannot be sorted on. They are calculated before
calculated columns, which can use them.
| Operation | Gives |
|---|---|
"average": 20 |
The mean of the last 20 rows (a moving average). Empty until there are 20 rows |
"exponential": 12 |
An exponential moving average with weight 2 / (12 + 1), started from the mean of the first 12 |
"indexed": 10000 |
10000 × value ÷ first value: the growth of 10,000. Use it to put a fund and its benchmark on one scale |
"drawdown": true |
How far the value is below its highest so far: 0% at a new high, -12.5% below it |
"change": true |
The change since the row before (a fraction, shown as a percent). Empty on the first row |
"cumulative": true |
The change since the first row |
"stdev": 20 |
The sample standard deviation of the last 20 rows. Used for Bollinger bands, or (of monthly returns, with 12) a rolling volatility |
"rsi": 14 |
The relative strength index (0 to 100) with Wilder smoothing over 14 changes |
"macd": [12, 26] |
The fast exponential average minus the slow one: [fast, slow], whole numbers 2 to 400, fast lower than slow |
"macdSignal": [12, 26, 9] |
The exponential average (9) of the MACD line: [fast, slow, signal] |
"rank": "desc" |
The rank of the value among the rows of its partition: the biggest is 1 ("desc", the default; true means the same). "asc" makes the smallest 1. A whole number |
"denseRank": "desc" |
The same, but with no gap after a tie |
"previous": true |
The value of the row above (empty on the first row). "previous": 3 looks 3 rows back (a whole number from 1 to 400) |
"next": true |
The value of the row below (empty on the last row). "next": 3 looks 3 rows ahead |
"difference": true |
The value minus the previous row's value, in the same units (empty on the first row). change gives the ratio instead |
format on a derived column overrides the table's. Drawdown, change and cumulative are percent unless you say otherwise.
Rank and neighbours (rank, denseRank, previous, next, difference):
"derived": [
{ "of": "Total", "as": "Rank", "rank": "desc" },
{ "of": "Total", "as": "Dense", "denseRank": true },
{ "of": "Total", "as": "Before", "previous": true },
{ "of": "Total", "as": "Step", "difference": true }
]
- Ties share a rank.
rankskips after a tie anddenseRankdoes not: values 90, 80, 80, 70 getrank1, 2, 2, 4 anddenseRank1, 2, 2, 3. - The partition is the record (the
recordKeycolumn among thegroupBycolumns) when there is one, otherwise the whole table. UsepartitionByfor another. The rank is counted inside the partition. - Rank follows the values. The neighbours follow the rows.
rankanddenseRankdo not depend on the order of the rows.previous,nextanddifferenceuse the rows as listed, aftersort, so they are the row above and below, not the calendar period before: a customer with no March has April'spreviousset to February. - Edge rows are empty, not zero, including every row closer to the edge than
n. A row whose own value is empty has an empty rank. rankanddenseRankare whole numbers.previous,nextanddifferenceare written in the table'sformat(or the entry's ownformat).- Like the other derived columns they cannot be sorted on or tested by
having.
Up and down capture (a group measure): { "Up": { "upCapture": "Return", "against": "Benchmark" }, "Down": { "downCapture": "Return", "against": "Benchmark" } }.
Over the rows where the benchmark rose (upCapture) or fell (downCapture), the result is the total of the column divided by the
total of the benchmark. A group with no rising (or falling) benchmark rows is empty.
Heikin-Ashi ("heikinAshi"): { "open": "O", "high": "H", "low": "L", "close": "C", "as": "HA" } adds HAOpen, HAHigh,
HALow and HAClose. Chart them with a candlestick chart whose open, high, low and close are those four columns.
3. Cross-tabs: pivot
"ByCategory": {
"from": "transactions",
"pivot": {
"rows": "Category",
"columns": "Quarter",
"value": { "sum": "Amount" },
"totals": true,
"format": "currency",
"scope": "perRecord"
}
}
| Key | Meaning |
|---|---|
rows |
One row per distinct value of this column |
columns |
One column per distinct value, found at run time and sorted |
value |
One of sum, avg, min, max, count, first, last, or a function from section 2 (median, percentile, distinct, ... with their extra keys: { "median": "Amount" }) |
totals |
true adds a Total column and a Total row. Sum or count only |
format |
Number style |
having |
Leave out rows (or columns) by their total. Goes inside pivot, next to value. See below |
scope |
What each record gets. perRecord: that record's own cross-tab, with the same columns for every record (the default when there is a recordKey and rows is a different column). summary: the whole cross-tab, the same in every document (the default when there is no recordKey). When rows is the recordKey, you get a single row: the record's own |
The result is text in a column named after the table (rows split by new lines, cells by |). In the template:
<<ByCategory>>{{CreateReportTable:|}}
Put it in a paragraph of its own. {{CreateTable:|}} also works and gives a plain bordered table.
having on a cross-tab. The same condition form as a summary table's having (section 2), with these differences:
"pivot": { "rows": "Customer", "columns": "Category", "value": { "sum": "Amount" }, "totals": true,
"having": [ { "column": "Total", "when": "gt", "value": 1600 } ] }
columncan only be"Total", even whentotalsis off (no Total column is drawn then, but the test still works). Any other name is reported (no number named 'Fuel').- A condition may carry
"on":"rows"(the default) leaves out the rows whose Total fails,"columns"leaves out the columns whose Total fails."level"is not allowed here. - A row's Total is the
valuefunction over all of the row's cells, and a column's Total is the same over all of the column's cells. A row is tested over every column, even one that an"on": "columns"condition then hides. - With
totals: true, the Total column and Total row then add up what is shown. - A per-record cross-tab (
scope: "perRecord") tests each row inside its record. A column is tested over every record, so it is kept or left out for all records alike. - If every row is left out and
totalsis off, the table is empty and a note saysevery group was removed by 'having', so the table is empty. Withtotals: true, you still get theTotalrow, with zeros.
4. Grouped layouts: layout
"Statement": {
"from": "transactions",
"layout": {
"groupBy": ["Category", { "month": "Date", "as": "Month" }],
"columns": ["InvoiceNo", "Date", "Amount"],
"subtotals": { "Subtotal": { "sum": "Amount" } },
"sort": ["Date"],
"format": "currency",
"lines": "Lines",
"rules": [ { "column": "Subtotal", "when": "gt", "value": 1000, "bold": true, "highlight": "yellow" } ]
}
}
| Key | Meaning |
|---|---|
groupBy |
1 to 4 levels (a column, or a date bucket with as) |
columns |
What each line shows. Every column when left out |
subtotals |
Any of sum, avg, min, max, count, or a function from section 2 (distinct, median, percentile, ...), worked out per group at every level. A Count of the group's lines is also provided |
sort |
How the lines are ordered. The groups are in natural order unless groupSort says otherwise |
groupSort |
Order the groups of a level by one of their numbers: [ { "level": 1, "by": "Subtotal", "dir": "desc" } ]. See below |
detail |
"show" (the default) or "hide". "hide" leaves out the detail lines and keeps the groups, subtotals and Count. See below |
suppressRepeats |
A list of line columns whose value is left blank when it equals the line above: ["Category"]. See below |
format |
Styles the subtotals |
lines |
Renames the list of lines (default Lines) |
running |
A running total on every detail line: { "Balance": { "sum": "Amount", "reset": "Month" } }. Can be sum, avg, min, max or count of the lines so far, in the order shown. reset names a groupBy level where the total starts again. Left out, it runs to the end of the record |
rules |
Highlight rules. A rule's column can be a group name, a line column, a subtotal or Count |
having |
Keep only the groups whose subtotals (or Count) meet every condition, in the same form as a summary table's having (section 2). Each condition may add "level", a whole number from 1 to the number of groupBy levels, to say which level's groups it tests. Level 1, the outermost, when left out. It goes inside layout, not beside it. See below |
A layout needs a recordKey, and a layout cannot feed a chart.
Order of work: having chooses the groups, then groupSort orders them, then the lines are listed (sort) and the running
columns are worked out in the order shown.
groupSort. A list, and each entry is { "level": 1, "by": "Subtotal", "dir": "desc" }:
| Key | Meaning |
|---|---|
level |
Which level's groups to order: a whole number from 1 to the number of groupBy levels (required). The groups of that level are ordered within each group of the level above (level 1: within each record) |
by |
A subtotal name, Count, or the level's own name (to order by the group's value, for example Month, newest first with "dir": "desc"). Required |
dir |
"asc" (smallest first, the default) or "desc" (biggest first) |
- Several entries for the same level are tie-breakers, in the order listed. Groups that are still equal keep their natural order.
- A group whose
byhas no value goes last, whichever waydirpoints. - The preview rows, the nested loops and the finished-table text all follow the new order, and a
runningcolumn counts along it. - A summary table (
groupBywithmeasures) has nogroupSort: order its rows withsort, for example"sort": [ { "by": "Total", "descending": true } ].
detail: "hide" (summary only). The headers, footers, subtotals and Count are worked out from every row before the lines
are dropped, so they equal the full report's. The list of lines is empty, so a {{ForEach:Lines}} loop repeats zero times, the
preview has only Header and Footer rows, and the <Name>Table text has only the group and Total rows. detail is fixed in the
recipe: for both a summary and a full document, use two layouts.
suppressRepeats.
- It names columns shown on the lines (
columns, any case). A column that is not shown is reported. - A line's value is blank when it equals the value above it, in the order shown (after
sort), within the same innermost group. At the start of each innermost group, every value shows again. - It compares the real values. Three equal lines show the value once, on the first. Subtotals,
Countandrunningcolumns are never suppressed. - Sort the lines so that equal values sit together. A value that comes back after a different one shows again.
having at any level.
- A condition with
"level": 2tests the groups of the secondgroupBylevel inside each group that is kept above. A condition withoutleveltests level 1. Conditions on the same level must all hold. - A level-1 group that fails disappears with everything under it.
- A dropped inner group leaves its parent unchanged: the parent's subtotals,
Countand footer still add up every row. A parent whose inner groups are all dropped stays, with its header and footer and no inner groups. - A note says how many were left out (level 1
groups, withamountsfor what they add up to, andinnergroups). The warningevery group was removed by 'having', so the table is emptyappears only when every level-1 group was removed. - A summary table's
havingtakes nolevel.
| Output | Tag |
|---|---|
Nested loops: Statement (group 1), Group2, Group3, Group4, Lines |
{{ForEach:Statement}} and so on (see lesson 14) |
One finished table, in a column called <Name>Table |
<<StatementTable>>{{CreateReportTable:\|}} |
4a. Label sheets: tile
"Labels": {
"from": "properties",
"tile": { "columns": 3, "skip": 0, "rowsPerSheet": 10, "as": "Rows", "fields": ["Address", "City"], "sort": ["City"] }
}
A tile table lays the rows of a table out across a sheet, row by row: the first columns rows are the first row of labels,
the next columns the second row, and so on. A table is a tile, a pivot, a layout or a groupBy with measures, not more than one. On the screen it is + Label sheet.
| Key | Meaning |
|---|---|
columns |
Labels across the sheet: a whole number from 1 to 12 (required) |
skip |
Empty positions at the start, for a partly used sheet: a whole number, 0 by default |
rowsPerSheet |
Rows of labels on one sheet: a whole number from 1 to 200. Left out, there are no sheets, only rows. Not needed for page breaks (see "The Word side") |
as |
A name for the list of rows on each sheet (default Rows), used with rowsPerSheet. Without rowsPerSheet it is a second name for the table's own list of rows |
fields |
The columns of the source table to put on each label (a list). Every column when left out |
sort |
A list of columns that orders the labels ({ "by": "City", "descending": true } for reverse). Source order when left out |
What the merge gets.
- Cell k of a row has the fields
<Column>_<k>, k from 1 tocolumns:<<Address_1>>,<<Address_2>>,<<Address_3>>. The row also has<<Row>>, its number counting from 1 across the whole table. - Padding. The last row is padded with empty cells, and the positions skipped by
skipare empty cells, so every table row hascolumnscells and no token is left showing. A padded or skipped cell has an empty value in every field. - Without
rowsPerSheet, the table's name is the list of rows:{{ForEach:Labels}}repeats once for each row of labels. - With
rowsPerSheet, the table's name is the list of sheets. Each sheet has<<Sheet>>(its number from 1) and its rows in the list calledas:{{ForEach:Labels}}...{{ForEach:Rows}}...{{EndForEach}}...{{EndForEach}}. The last sheet has only the rows it needs. Skipped positions come first and can push the labels onto a further sheet. - Records. A recipe with a
tileand norecordKeymakes one record, so one document holds the whole sheet. With arecordKey, the sheet is a list on every record, the same for each. dp-node prepwrites the table as a flat file:Sheet(with sheets),Row, then every field of every cell (Address_1,Address_2, ...).- A label sheet cannot feed a chart. A column named
RoworSheetcannot be a label field, because the layout uses those names.
For the 11 properties in properties.csv with "columns": 2, ordered by City and Address, the table has 6 rows. Row 1 is P110 and
P105, and row 6 has only P109. With "skip": 3 it has 7 rows, and the first label is in the second cell of row 2.
The Word side. The engine repeats table rows. Word holds the measurements. DataPublisher ships no vendor label sizes: take every measurement from the package, the maker's template, or a ruler.
- Page. Set the page size and margins to the sheet's. Leave the header and footer empty, with distances that do not push the table down.
- One table with one row, and one cell for each label across. Where the sheet has a gap between labels, add an empty gutter cell with the gap's width. A gutter cell has no field.
- Fixed layout. In Table Properties, turn off automatic resizing, set the width of every cell, and set the table's left indent to 0.
- Exact row height. Set the row height to Exactly, equal to the pitch: the distance from the top of one label to the top of the next. Turn off "Allow row to break across pages".
- Zero margins. Default cell margins 0, no borders, and paragraph spacing before and after 0. An exact row height cuts off what does not fit.
- The loop. Put
{{ForEach:Labels}}at the start of the text of the first cell and{{EndForEach}}at the end of the text of the last cell, with each cell's own fields between them (<<Address_1>>in the first label cell,<<Address_2>>in the next). - Sheets and page breaks. Recommended: no
rowsPerSheet, one table. With exact row heights and a page body at leastrows × row heightand less than one more row, Word starts each new sheet on its own page by itself. Do not add page-break paragraphs. UserowsPerSheetonly when each sheet needs its own heading: then put the table inside the sheet loop, with{{ForEach:Labels}}in a paragraph above the table and{{EndForEach}}in a paragraph below it, and make that last paragraph 1 pt (exact line height 1 pt, font size 1 pt, spacing 0), because the engine copies its settings to the separator between sheets. - The paragraph after the table. Word requires one. Make it a 1 pt exact-line paragraph, and leave about 0.1 inch of slack in the page's bottom margin, or Word can put it on a blank extra page.
- Print at actual size. Turn off "fit to page" and any scaling.
- Check. Print one sheet on plain paper and hold it against a real label sheet in front of a light. Compare the edges of the first and last rows and columns, adjust, and repeat. A printer driver may still shift the print a little.
What was checked in real Word. On a sheet of 2 labels across and 4 rows down (row height exactly 168 pt, fixed layout, zero cell
margins): every row was exactly 168 pt below the one before, every cell was where the table puts it, the last row was padded, skip
put the first label in the right position, and there was no extra blank page. A printed sheet against real labels was not checked.
The sample T21-property-signs.docx and the school co-op name-tag sheet use design values, not any maker's measurements.
5. Totals
"totals": {
"GrandTotal": { "from": "transactions", "sum": "Amount" },
"CustomerTotal": { "from": "transactions", "sum": "Amount", "perRecord": true },
"VisitCount": { "from": "transactions", "count": "*", "perRecord": true },
"AvgPerVisit": { "formula": "CustomerTotal / VisitCount", "format": "currency" }
}
| Key | Meaning |
|---|---|
from |
Source table |
sum / avg / min / max / count |
The calculation (count: "*" counts rows). The functions from section 2 (median, percentile with p, distinct, ...) work here too, also with perRecord |
perRecord |
true: each record gets its own value. Otherwise there is one value for everyone |
formula |
Used instead of from and a calculation: an expression over other totals (section 9) |
format |
Number style |
rules |
Highlight rules (leave out column) |
In the template: <<GrandTotal>>. A total over a linked table where a record has no rows counts as 0 for sum and count.
6. Charts
"Monthly": {
"type": "bar",
"from": "ByMonth",
"x": "Month",
"y": ["Total", "Running"],
"title": "Spending by month - {Customer}",
"format": "currency",
"scope": "perRecord",
"width": 640,
"height": 340,
"labels": true
}
Common settings
| Key | Meaning |
|---|---|
type |
bar (vertical columns), hbar (horizontal bars), line, area, combo (bars with lines over them), donut, pie, scatter, bullet, sparkline, histogram. Specialist types: candlestick, ohlc, waterfall, heatmap, curve |
from |
A summary table of this recipe (not a cross-tab, and not a layout) |
x |
Any column of the table. For scatter and histogram it must be a number |
y |
A calculation or running total (or derived or calculated column), or a list of them (one series each, with a legend). donut, pie, bullet, sparkline, waterfall and heatmap take one |
title |
May contain {Customer} (the recordKey column's name) or {key}. A sparkline has no title |
format |
number (default), currency ($430.50) or percent. In a scatter, it is the format of the y axis |
scope |
perRecord (default, needs a recordKey) or summary (one chart, the same picture in every document) |
width, height |
Pixels, 240 to 1600 wide and 160 to 1200 high. The default is 640 × 340. A donut or pie is 640 × 300. A sparkline is 200 × 48. Pictures are drawn at 2× |
labels |
false removes value labels. For a sparkline it removes the latest value printed at the end |
stack |
For bar, hbar, area and combo with several y: none (default, side by side), stacked (piled up, with the stack total on top) or percent (each category's pieces as shares of 100%; not for combo) |
axisMin |
Where the value axis starts instead of zero: a number, or "auto". Not with a stack. Bars begin at this line, and values below it are cut off and warned about. A bar chart whose axis does not start at zero exaggerates differences, so use this deliberately |
colors |
A list of 1 to 12 colors, each "#RRGGBB", used in order for the series (or the slices of a donut or pie). A short list keeps the standard colors for the rest |
refLines |
1 to 6 dashed lines across the value axis, each a number or { "value": 58, "label": "Target" }. Works on bar, line, area, combo, scatter, candlestick, ohlc, curve |
bands |
1 to 4 shaded ranges { "from": 52, "to": 55, "label": "Buy zone" } behind the data. Same chart types as refLines |
sliceLabels |
true on a donut or pie prints each slice's percent on the slice (slices under 6% are left to the legend) |
colorBySign |
true on a bar or hbar with one series: gains in the first color and losses in a second one that stays apart from it |
Settings for specific chart types
| Type | Settings |
|---|---|
combo |
lineY (required): the column or columns drawn as lines over the bars, on the same scale. y and lineY together take at most 8 columns |
scatter |
label: the column that names each dot. Give several y columns for several colors and shapes |
bullet |
target (required): the number column each row's y is measured against |
histogram |
bins: about how many ranges (2 to 40). Left out, it picks 5 to 12 from the number of rows. x must be a number |
candlestick, ohlc |
open, high, low, close (all four required); volume, overlays (1 to 4 lines over the prices, such as moving averages), rsi, macd ({ "line": "MACD", "signal": "Signal" }), and for candlestick only volumeWidth |
waterfall |
totalBars: a list of x values drawn as whole totals from zero. closing: adds a last total bar with that name |
heatmap |
rows (required): the column down the side (x is across the top). The table needs one row for each pair, so group by both |
curve |
Lines over a numeric x axis (a number, or text like 3M, 10Y, 30D). seriesBy: a column whose values each get a line. xScale: linear (default) or log |
line, area, candlestick, ohlc, curve |
ranges: 1 to 3 shaded bands, each { "low": "Lower", "high": "Upper", "label": "Bollinger bands" }. List the widest first |
Notes
- A chart gives each record a picture in the column
Chart_<Name>. In the template:[[Chart_Monthly]]{{ResizeImageTo:420}}. - Bars, lines and areas start at zero unless you set
axisMin. In a stack, positive values pile up from zero and negative ones go down from it. hbaris the one to use for long names (customers, products). The names get the left side, up to 40% of the width.- A
percentstack counts negative values as zero and warns. - A
pieis a donut without the hole. Both warn with more than 8 slices. Add"top": { "n": 7, "by": "..." }to the table. - A
scatterdraws one dot per row. Rows missing either number are left out. Thexaxis shows plain numbers even whenformatis currency. - A
bulletchart draws one bar per row: the value, a dark mark at its target, and the value, target and percent of target printed beside it. A row with no target shows just the value. - A
sparklineis a tiny line with no axes and a transparent background, for a table cell or a sentence. It shows the shape, not the size. - A
histogramcounts the rows whosexfalls in each range. Usescope: "summary"for the distribution of everything. - A price chart (
candlestick,ohlc) draws only the rows that exist, one slot each, with no gap for weekends or holidays. A rise is a hollow body in blue and a fall a filled body in vermillion, and the legend says so, so the chart does not rely on color alone. - Technical studies (moving averages, RSI, MACD, Bollinger bands, drawdown, growth of 10,000) are columns made with
derivedon the table. Draw them asoverlays, alineorarea, or abarwithcolorBySign. - A
waterfallshows increases in blue, decreases in vermillion and totals in grey. The order of the bars is the order of the rows, so sort the table. - A
heatmapshades each cell by its number. When the numbers go both ways, it uses blue above zero, vermillion below it, and white at zero. - A
curveis spaced by the value ofx, not by the row. A yield curve isxthe term,ythe rate,seriesBythe date andxScalelog. With more than 8 lines the colors repeat and the recipe warns. - Accessibility and consistency: colors are color-blind safe unless you set
colors. Every value is also printed as text. Alt text (title and values) is set in the document. The font is built in, so charts are identical on every machine. - Charts are normal pictures. They work in Word, PDF, e-mail bodies and
.odt.
6a. Barcodes: barcodes
"barcodes": {
"InvoiceCode": { "type": "code128", "value": "InvoiceNo" },
"PayLink": { "type": "qr", "pattern": "https://example.com/pay/{InvoiceNo}", "moduleSize": 6, "level": "Q" }
}
Each entry makes a picture of each record's value in the field Barcode_<Name>. In the template:
[[Barcode_InvoiceCode]]{{SetImageWidth:200}}. It is a normal picture, like a chart, so it works in Word, PDF, e-mail bodies and
.odt. On the screen it is the Barcodes card and + Barcode.
| Key | Meaning |
|---|---|
| name | Barcode_<Name> is the field. The name starts with a letter and uses letters, digits and underscores, and Barcode_<Name> must not clash with a data column, table, total, chart or parameter |
type |
code128 or qr (required) |
value |
What to encode: a column of the record's data (read from the record's first row), a per-record total or a parameter. Blank edges are trimmed. Give exactly one of value and pattern |
pattern |
Instead of value: text with {Column} placeholders, such as https://example.com/request/{PropertyId}. At least one placeholder is required, and each names a column (any case). {Column} puts the value in as it is. {Column:url} percent-encodes it for a web address (10 Oak St becomes 10%20Oak%20St). Nothing else may follow the colon. If a column used is blank, there is no picture |
in |
The name of a tile table (section 4a): make the barcode for each label cell instead of each record (below) |
scope |
Only "perRecord" (the default) is accepted |
moduleSize |
Pixels in the narrowest bar (Code 128) or in one square (QR): a whole number from 1 to 20. Default 3 for Code 128, 8 for QR |
height |
code128 only: pixels high, from 20 to 1000. Default 120 (a QR code is square) |
level |
qr only: error correction L, M, Q or H. Default M |
The picture is black and white only, with whole-pixel modules and no smoothing. White quiet zones are part of it (10 modules
each side for Code 128, 4 for QR). Its alternative text is Code 128 barcode for <value> or QR code for <value>. Records with the
same value share one picture.
Code 128 is drawn by DataPublisher itself and holds the ASCII characters 0 to 127 (code sets A, B and C are chosen for you, and the check symbol is added). A value with any other character (an accent, say) gets no picture and a warning. QR holds any text, as UTF-8.
Size it in Word. The default picture width is 108 points. Put {{SetImageWidth:N}} (points) after the field, and for sharp edges
make N a whole multiple of the picture's modules, quiet zones included. Scan a printed or on-screen sample before you rely on
it. Put the field alone in its own paragraph.
Barcodes on labels: in. With "in": "Signs" the barcode is made for each label cell of the tile table Signs. The picture
fields are [[Barcode_<Name>_1]] ... [[Barcode_<Name>_N]], one for each of the tile's columns, so each goes in the cell with the
same number as <<Address_1>>. value and pattern read the tile's fields:
"tables": { "Signs": { "from": "properties", "tile": { "columns": 2, "fields": ["PropertyId", "Address"] } } },
"barcodes": { "Scan": { "type": "qr", "in": "Signs", "pattern": "https://example.com/request/{PropertyId}?for={Address:url}" } }
A cell with no value in any of the tile's fields (padding, or a skipped position) has no picture and is not counted, so it does not
warn. A cell that has values but a blank column used by the pattern does warn. The address example.com is made up. The real
link comes from your own DataRequest links or whatever your form's address is: put it in a column and use it as value, or build
the pattern around it.
Limits and mistakes.
- One barcode for each record (or each label), not for each table row.
[[Barcode_Name]]repeats the record's own picture inside a{{ForEach}}loop. A barcode on each detail line is not available. - A QR value over the symbol's capacity (in UTF-8 bytes: 2,953 at
L, 2,331 atM, 1,663 atQ, 1,273 atH) gets no picture and a warning. A picture is at most 4,096 pixels wide. dp-node prep --outwrites only the picture's path in theBarcode_<Name>column of_records.csv. The picture is drawn during the merge, and the Summaries & Charts Preview does not draw barcodes.- Mistakes are listed in section 15.
7. Number formats
"format" can be set on a groupBy table, a pivot, a layout's subtotals, a calculated column or a total.
| Value | Writes | Example |
|---|---|---|
plain (default) |
Two decimals, no separators. What {{SUM}} writes |
1020.00 |
number |
Thousands separators | 1,020.00 |
currency |
$ and separators. Negatives as -$5.00 |
$1,020.00 |
percent |
A fraction as a percent | 0.125 becomes 12.5% |
- Format changes how numbers are written, not what they add up to. Sorting, running totals and the Total row and column are calculated on the numbers first.
- A count is a whole number, grouped (
1,234) when the style is not plain, and never currency. - Charts read the numbers back, so they work with any style.
{{CreateReportTable}}right-aligns all of them.- Format a number in one place, the recipe or the template function, and check the result if you use both.
8. Highlight rules: rules
Available on a groupBy table, a layout, or a total.
"rules": [
{ "column": "Total", "when": "lt", "value": 0, "color": "red", "bold": true },
{ "column": "Total", "when": "between", "value": 100, "to": 500, "highlight": "yellow" }
]
| Key | Values |
|---|---|
column |
A column of the table. Leave it out on a total |
when |
lt, lte, gt, gte, eq, ne, between (with to), is, contains (text, ignoring case), blank, notBlank |
value, to |
The value or values to test against |
color |
black, gray, red, orange, gold, green, blue, purple, or a hex code |
bold, italic |
true |
highlight |
yellow, green, cyan, red, gray (Word's own highlighter colors) |
- A rule needs at least one of
color,bold,italicorhighlight. - The first rule that fits a cell wins.
- The test reads what the cell shows, so
$1,020.50,-$5.00and(5.00)are numbers. Text never meets a number test. For a12.5%cell, the number is 12.5. - Rules apply to
<<Field>>in a{{ForEach}}row, to totals and to per-record totals. Cross-tabs and chart pictures are not styled. - A template function after a styled value (
<<Total>>{{FormatCurrency}}) works on the text and keeps the style. - If you misspell a key you get a hint such as "Did you mean 'color'?".
9. Formulas
One small expression language, used in two places.
What you can write: numbers, names, + - * /, parentheses, comparisons (< <= > >= == !=), and round(x, 2), abs(x),
min(a, b, ...), max(a, b, ...) and if(condition, then, otherwise). Names are not case-sensitive. Nothing is run as code.
Formulas use the full-precision numbers, not the rounded text. A value that cannot be worked out is left empty and reported
once.
Calculated columns ("calculated" on a groupBy table):
"calculated": {
"ShareOfCustomer": { "formula": "Total / CustomerTotal", "format": "percent" },
"ShareOfCompany": { "formula": "Total / GrandTotal", "format": "percent" }
}
A calculated column can use this table's calculations, running totals and earlier calculated columns, and any total in the recipe.
A per-record total is read for the row's own record, so the table needs the recordKey column. format defaults to the table's.
The column can be charted (y), highlighted (rules) and used in the template, but it cannot be sorted on or ranked by top.
Formula totals: "Margin": { "formula": "(Revenue - Cost) / Revenue", "format": "percent" }. A formula total can use any other
totals, in any order. A total that uses itself, or two that use each other, is reported. It is worked out per record when any total
it uses is per-record, otherwise once. It takes format and rules.
Text, logic and dates. The same language also handles text, which is what computed columns are for. (Calculated columns and
formula totals still need numbers. A formula that comes out as text there is left empty.)
| Adds | Meaning |
|---|---|
"text" or 'text' |
A text value. Double the quote to include one ('it''s') |
[Customer Name] |
A name with spaces or other characters, in square brackets |
a & b |
Joins text (a number is written without trailing zeros). + joins two texts too, but text that looks like a number ("12", "1,234.50") counts as that number in + - * / and in comparisons: "12" + "5" is 17, while "12" & "5" is 125 |
and, or, not |
Logic. and and or stop at the first answer, so if(B > 0 and A / B > 1, ...) is safe |
upper, lower, trim, len, left(s, n), right(s, n), mid(s, start[, length]) (start from 1), replace(s, find, with), contains(s, part), startswith(s, part) (ignore case), concat(a, b, ...) |
Text functions |
text(x), text(x, 2), text(date, "MMM d, yyyy") |
A value as text: plain, with 2 decimals, or a date in a pattern |
num(s) |
Text as a number (empty when it is not one) |
isblank(x) |
1 when the value is empty or missing |
year(d), month(d), day(d), datediff("d" or "m" or "yyyy", from, to) |
Dates |
Comparisons work on text too (Region == "East", and < and > order text alphabetically). if can give text.
Computed columns ("computed", at the top level of the recipe): new columns for every row of a data table, worked out
before anything else. The rest of the recipe treats them as ordinary columns: you can group by them, show them on layout
lines, total them and filter on them.
"computed": {
"sales": {
"Label": { "formula": "upper([Customer Name]) & ' (' & Region & ')'" },
"Discounted": { "formula": "Amount * Rate" },
"Size": { "formula": "if(Amount >= 100, 'big', 'small')" }
}
}
A formula may use the columns of the same table (including computed ones above it) and the recipe's parameters (Rate
above), but not totals or calculations. The name must start with a letter, use only letters, digits and underscores, and not
already be a column. A row where the formula cannot be worked out gets an empty cell, and the run says how many. A number result
is written as plain text (37.5, not 37.50), so format it in the template ({{FormatCurrency}}).
10. Parameters and filters
"parameters": {
"From": { "type": "date", "label": "From date" },
"Area": { "label": "Region", "choicesFrom": { "table": "customers", "column": "Region" } },
"MinAmount": { "type": "number", "default": 0 }
},
"filters": [
{ "table": "transactions", "column": "Date", "when": "gte", "parameter": "From" },
{ "table": "customers", "column": "Region", "when": "is", "parameter": "Area" }
]
| Parameter key | Meaning |
|---|---|
type |
text (default), number, date or dateRange |
label |
What to ask |
default |
A starting value |
required |
true to insist on a value (default false) |
choices |
A typed list (enforced) |
choicesFrom |
{ table, column }. The screen offers the distinct values as a drop-down (not enforced). May add where to depend on another parameter (below) |
multiple |
true: several values from one control (below). Not with dateRange |
all |
An explicit "(All)" choice for a list (below) |
| Filter key | Meaning |
|---|---|
table, column |
What to filter |
when |
For text: is, contains, ne (ignoring case). For numbers and dates: eq, ne, lt, lte, gt, gte. For a multiple parameter: in, notIn. For a dateRange: between. A when that does not fit the parameter is reported with the allowed list |
parameter |
Which parameter supplies the value |
- A filter whose parameter has no value is skipped, so an optional parameter left blank means "everything".
- A cell that is not a date or number is left out and reported once.
- Filtering the data table (the one with the records) removes records. "Region = East" gives documents for East customers only.
- If filters leave a table with no rows, the run says which and fails rather than producing an empty document.
- Every parameter is also a field of the document:
<<From>>,<<Area>>(empty when there is no value). - Names. A parameter name must differ from every column of every table the report loads, every total, table and other
parameter:
Parameter 'Region': the name 'Region' is also a column in 'customers'. Rename the parameter so the merge can tell them apart.AdateRangenamedBillingPeriodalso takes the namesBillingPeriod_FromandBillingPeriod_To. - Values come from:
--param Name=Valueon the command line (also onprep), the Run tab's Values for this run form, the screen's preview form and a job file'sparameters. A wrong value (not a date, not a choice, an unknown parameter, or a missing required one) lists every problem and starts nothing (exit 3). Values are text all the way through. - Length. A value is at most 500 characters (for a list, the text of the whole list joined with
|). - Date shortcuts in a value: start with
=. For example=today,=yesterday,=startOfWeek,=startOfMonth,=endOfLastMonth,=startOfLastQuarter,=endOfLastYear, with an optional offset such as=today-30dor=startOfMonth+1m. These are worked out when the run starts, in the schedule's time zone. It is a fixed list, never code.
Several values: "multiple": true.
"parameters": { "Cat": { "label": "Category", "multiple": true, "choicesFrom": { "table": "transactions", "column": "Category" } } },
"filters": [ { "table": "transactions", "column": "Category", "when": "in", "parameter": "Cat" } ]
- A value is text with
|between the items,Fuel|Parts(items are trimmed and empty items ignored), or a list where the host gives JSON (a job file, the API):["Fuel", "Parts"]. An item cannot contain|. inkeeps rows whose cell equals any item.notInkeeps rows whose cell equals none. Text is compared ignoring case. Fornumberanddate, items and cells are compared as numbers or days.- With
choices, every item must be one of them:Parameter 'Area': 'South' is not one of the choices: 'East', 'West', 'North'. - Nothing picked (a blank value) is no filter.
<<Cat>>prints the list asFuel, Parts.defaultmay beFuel|Parts.
A date range: "type": "dateRange".
"parameters": { "BillingPeriod": { "type": "dateRange", "label": "Billing period", "default": "2026-01-01..2026-06-30" } },
"filters": [ { "table": "transactions", "column": "Date", "when": "between", "parameter": "BillingPeriod" } ]
- The text form is
from..to: two dates with two dots between them,2026-01-01..2026-03-31.{ "from": ..., "to": ... }and[from, to]are accepted where the host gives JSON. - Either end may be left out:
2026-03-01..(from that day on) or..2026-02-28(up to that day). Both left out is no filter. - The filter is
between, and both ends are included. - A text without
..is an error that shows the form, and a start after the end is an error (section 15). - In the document,
<<BillingPeriod>>prints2026-01-01 to 2026-03-31(orfrom 2026-03-01, orup to 2026-02-28), and<<BillingPeriod_From>>and<<BillingPeriod_To>>print the ends (empty when left out). - A
dateRangetakes nochoices,choicesFromormultiple.
An explicit "(All)": "all". For a parameter with choices or choicesFrom: "all": true adds a choice called (All), and
"all": "Everyone" names it. Picking it means no filter, counts as an answer for required (a blank does not), and the document
prints nothing for it. It is compared ignoring case, so --param Cat=(all) works. all without a list is an error.
Lists that depend on each other: choicesFrom.where.
"Cat": { "multiple": true, "all": true, "choicesFrom": { "table": "transactions", "column": "Category" } },
"Who": { "all": true, "choicesFrom": { "table": "transactions", "column": "Customer",
"where": { "parameter": "Cat", "column": "Category" } } }
Who offers the distinct values of Customer from only those transactions rows whose Category equals the value of Cat now (any
of them when Cat is multiple, and every row while Cat is blank or (All)). It changes the list offered, which is a
drop-down only, so it does not restrict what a command-line --param may say. The choices are sorted and at most 500 are offered. A
chain of parameters is fine. A loop is not.
11. Sub-report links: links
"links": { "payments": "CustName" }
This means: "In payments, the CustName column holds the recordKey value."
- Needs a
recordKey. - The table you link must not already have a column with the record key's name. Link the column it has, or use no link.
- Linking the data table itself is allowed (
"customers": "Name"). Its original column is still a field of the document. - Filters,
groupBy, layouts and the document use the record key's name (Customer), neverCustName. - On the command line:
--detail "payments=payments.csv@Customer=CustName". The screen does this for you. - A record with no rows counts as 0 for a
sumorcounttotal.min,maxand tables stay empty.
12. Template tags
Fields and loops
| Tag | Meaning |
|---|---|
<<Field>> |
This record's value |
<<Field>>{{Function}} |
The value, then a function. Works inside loops on every row |
{{ForEach:Table}} ... {{EndForEach}} |
Repeat for each row of a child table |
{{RowNumber}} |
The row's number inside a loop |
<<Table.Column>> |
A dotted field from a linked table above the primary one (Data Set merges). Also works inside the table's own loop: inside {{ForEach:ByMonth}}, <<ByMonth.Month>> is the same as <<Month>> |
{{IF cond THEN "a" ELSE "b"}} |
Inline conditional |
{{IF cond THEN}} ... {{ELSE}} ... {{ENDIF}} |
Block conditional with an optional {{ELSE}} (see "Conditionals" below) |
Display functions (after a field)
{{FormatCurrency}}, {{FormatCurrency:2}}, {{FormatDate:MMM d, yyyy}}, {{ToUpperCase}}, {{OrDefault:"(none)"}},
{{AddSuffix: USD}}, {{MakeBold}}, plus the conditional color functions ConditionalColor, ConditionalHighlight,
ConditionalColorNumeric and ConditionalFormatString.
Tables and pictures
| Tag | Meaning |
|---|---|
<<Name>>{{CreateReportTable:\|}} |
Text turned into a finished-looking table. Own paragraph. The delimiter is \| (a comma if none is given) |
<<Name>>{{CreateTable:\|}} |
The plain bordered table |
[[Chart_Name]] |
A chart picture |
[[Barcode_Name]] |
A Code 128 or QR picture of the record's value (section 6a). On a label sheet: [[Barcode_Name_1]] ... [[Barcode_Name_N]], one for each label cell. Alone in its own paragraph |
[[Field]] |
A picture whose file path is in the field's value (this is how charts work). Also works inside a loop, from each row's value |
{{ResizeImageTo:N}} |
Width of the picture in points (text width is about 468) |
{{SetImageWidth:N}} |
Width of the picture in points, the height keeps the proportions (the default is 108) |
{{CreateReportTable}} look:
| What | How it looks |
|---|---|
| Header row | Bold, light blue-grey shading, a rule above and below, repeats at the top of each page |
| Number columns | Right-aligned, header included. A column is numeric when it has a value and every non-blank cell is a number: 1,234.50, -5, -$5.00, +7, 12.5%. The first column holds row labels and stays left-aligned |
| Total row and column | A row whose first cell is Total, and a column headed Total (any case, nothing else: not Totals or Subtotal), are bold. The row is shaded and ruled |
| Rules | A thin grey line between body rows, a firm line closing the table, no vertical lines |
| Width | Full text width. Rows do not split across pages |
It works in .docx and .odt. The first row is the header.
Links
| Tag | Meaning |
|---|---|
<<Value>>{{Bookmark:Group}} |
Marks this value as a link target, named from the group and the value |
<<Value>>{{Bookmark:Group:Qualifier}} |
Also adds the value of the field Qualifier (read from the same record) to the name |
<<Value>>{{LinkTo:Group[:Qualifier]}} |
Makes the value a clickable jump to the matching bookmark |
Groupis optional (the default isdp).- Bookmark names are hidden in Word (they begin with
_). They are cleaned to letters, digits and_, start with a letter, and are 40 characters at most. When cleaning changed the value, or it is long, a short code is added so different values never collide. - A repeated bookmark name keeps the first and warns. A link with no bookmark stays plain text and warns.
- In
.docxyou get a Word bookmark plus a hyperlink to it. In.odtyou get a bookmark plus a link to#name. Both survive PDF export. - No page numbers on links.
- Inside a loop, links are made by Turbo mode (the add-in default), the command line and the server. The add-in's Interactive mode makes them outside loops only, and says so.
Page fields
{{PageNumber}} and {{TotalPages}} are live Word fields.
Conditionals
{{IF CustomerTotal > 2000 THEN "high-volume" ELSE "standard"}} inline, inside a sentence
{{IF CustomerTotal > 2000 THEN}}
Over 2,000.
{{ELSE}}
2,000 or less.
{{ENDIF}}
- Block form: keeps the part before
{{ELSE}}when the test is true and the part after it when it is false.{{ELSE}}is optional. It works over whole paragraphs, inside one paragraph, and nested. A stray{{ELSE}}with no{{IF}}is removed with a warning. - Tests:
=,==,!=,<>,>,<,>=,<=. Text comparisons (=,!=,<>) are exact and case-sensitive, and quote text values. Number comparisons need numbers on both sides, otherwise they are false.{{IF Field EXISTS}}(or{{IF Field != }}) is true when the field has a value. - Inside a
{{ForEach}}, an{{IF}}is decided for each row, from that row's values (and the outer record's, where the row has no such field). Use it to leave a band out or to change a word for the rows that need it. Both forms work.
Headers and footers
<<Field>>, functions after a field, and {{IF}} work in a header or footer the same way as in the body, for each record:
Statement for <<Customer>> - <<Region>>. A page number or count stays a live Word field ({{PageNumber}} and {{TotalPages}}, or
Word's own fields).
- One record per page (Run tab layout A page for each ...,
--mode one-per-page): each record gets its own section, with its own header and footer. - Records that run together on shared pages (Run them together, no page breaks): all pages keep the first record's header and footer.
- No loops and no pictures in a header or footer: a
{{ForEach}}or[[Picture]]there is left as written, with a warning. - A header with only fixed text works as before (no extra sections).
- Works for
.docxand.odttemplates in server runs and withdp-node. The add-in's Interactive mode and the Windows desktop merge do not give each record its own header (see section 16).
13. Command line: dp-node
dp-node prep --data transactions.csv --recipe statement.recipe.json [--preview] [--out dir] [--param Name=Value]...
dp-node merge --template t.docx --data transactions.csv --recipe r.json --out ./out --name "{Customer}"
[--detail "Name=file.csv@KeyColumn[=OtherColumn]"]... [--mode one-per-page] [--param ...] [--pdf]
| Option | Meaning |
|---|---|
--data |
The primary table. It is called by its file name without .csv |
--detail "Name=file.csv@Key" |
Another table, linked on Key. Use @Key=OtherColumn when the other file names the key differently |
--recipe |
A recipe file |
--template |
A .docx or .odt template |
--out |
Output folder |
--name "{Customer}" |
File name pattern, using a record column. Not allowed with --mode one-per-page |
--mode one-per-page |
All records in one document |
--param Name=Value |
A parameter value (repeatable). Put a value with \| (several values) in quotes: --param "Cat=Fuel\|Parts". A date range is --param BillingPeriod=2026-02-01..2026-03-31 |
--pdf |
PDF output, using Word (Windows) or LibreOffice |
--preview (on prep) |
Print the first rows of every table and write no data files. Add --out to also write the first record's charts |
--json |
Machine-readable output |
--image-base, --image-fallback |
Where [[image]] fields look for pictures |
dp-node prep --out <dir> writes _records.csv, one <Table>.csv per table, chart pictures in _dp-charts/, and
_manifest.json. For barcodes, _records.csv holds only the picture's path in the Barcode_<Name> column. The picture itself is
drawn during the merge.
Exit codes: 0 ok · 1 usage · 2 file not found · 3 invalid recipe, job or parameter (nothing written) · 4 failed (or the server refused or could not be reached) · 5 done with warnings (files are written) · 6 an output file already exists.
14. Report jobs: dp-node job
A job file (<name>.job.json) is the saved answer to: which template, which data, which recipe, which parameter values, one
document per recipient or one for all, delivered how, and when. The server stores the same format.
dp-node job validate nightly.job.json [--data customers.csv] [--json]
dp-node job show nightly.job.json [--now 2026-12-01T12:00:00Z] [--json]
dp-node job next nightly.job.json [--count 5] [--from <date-time>]
dp-node job run nightly.job.json [--out out] [--table payments=payments.csv] [--param From=2026-01-01] [--overwrite] [--json]
dp-node job remote list | run | status | download ...
dp-node job schema > job.schema.json
A minimal job file:
{
"template": { "file": "statement.docx" },
"data": { "file": "customers.csv" },
"recipe": { "file": "statement.recipe.json" },
"fanOut": { "mode": "perRecipient" },
"output": { "nameTemplate": "Statement_{Customer}" }
}
job runruns on this computer, for the operating system's scheduler (Task Scheduler, cron or a systemd timer). It readstemplate.file,data.fileandrecipe.file(orrecipe.inline) relative to the job file, writes the documents plus a_run.json(the records, who each is for, and the parameter values used), and exits. The job's ownscheduleis not used. It never overwrites without--overwrite(exit 6). A job file that names server items (templateId,dataFileId,recipe.name) is refused, with a message to usejob remote run. A job with e-maildeliverymakes its files and sends nothing (a warning, exit 5).job remoteworks on the server's report jobs. It needs--server https://...(orDP_SERVER) and a key in an environment variable (defaultDP_API_KEY, or choose another with--key NAME). The key is never typed on the command line (a key given there is refused), and it is only sent over https.list: id, name, schedule, next run and last result.run <id or name> [--param N=V]... [--wait] [--timeout 900] [--out dir]. With--waitit follows the run and exits 0 only if it finished. A run that fails or waits for approval exits 4 with the reason.status <run id>·download <run id> --out dir [--zip] [--overwrite].- API keys start with
dpk_, have the scopes read, run and write (shown as Read, Run and Change on screen), expire within a year (default 90 days) and can be revoked. Every request is recorded. A key can never arm a report, approve a run, resume a stopped run or settle an uncertain e-mail. - Schedules use a five-field cron in an IANA time zone (
"cron": "0 7 1 * *", "timezone": "America/New_York"). A time that does not exist on a spring-forward day runs once, shifted forward. A time that happens twice on a fall-back day runs once, the first time. - Delivery is test mode unless the job says otherwise. A job with
deliverymust usefanOut.mode: "perRecipient"and namefanOut.emailColumn.
15. Error and warning messages
Errors are reported all at once, with "Did you mean...?" for column, table and function names. An invalid recipe exits with 3 and writes nothing.
| Message (shortened) | Cause | Fix |
|---|---|---|
recordKey: no column named 'Custmer' in any table. Did you mean 'Customer'? |
Typo | Correct it |
Table 'ByMonth': no table named 'transaction'. Did you mean 'transactions'? |
from names a missing table |
Correct it |
Table 'Bad', measure 'Total': unknown function 'summ'. Did you mean 'sum'? |
Typo in a calculation | Correct it |
Chart 'Oops': 'lines' is not a valid type. Did you mean 'line'? |
Unsupported chart type | Use a type from section 6 |
Chart 'Oops': 'from' must be one of the tables in this recipe. |
Chart source missing | Point at a summary table |
...the name 'Amount' is also a column in 'transactions'. Rename the measure... |
Name collision | Rename it |
...is a groupBy column, not a number. Use a measure or running total |
Chart measures a group column | Chart a calculation |
a perRecord chart needs "recordKey"... or set "scope": "summary" |
No record key | Set the record key, or use summary |
'rows' and 'columns' are both ...; they need to be different columns |
Cross-tab | Choose two columns |
Table 'X': add a calculation. |
A summary table with no calculation | Add one |
Table 'X', having[0]: no measure named 'Totl'. Did you mean 'Total'? |
having names something that is not a calculation |
Correct it. A running, derived or calculated column cannot be tested |
Table 'M': put 'having' inside 'pivot', next to 'value'. |
A cross-tab's having is beside pivot, not inside it |
Move it inside pivot (section 3) |
Table 'M', pivot, having[0]: no number named 'Fuel'. The numbers are: 'Total'. |
A cross-tab's having can only test Total |
Use "column": "Total", with "on": "rows" or "columns" |
Table 'M', pivot: 'totals' needs sum or count, because median of cells cannot be added up. |
totals on a cross-tab with another function |
Remove totals, or use sum |
Table 'X', layout, having[0]: 'level' must be a whole number from 1 to 1 (the groupBy levels). |
A layout having level that does not exist |
Use a level from 1 to the number of groupBy levels |
Table 'X', layout, groupSort[0]: 'by' must be a subtotal, 'Count', or the group's own name: 'Subtotal', 'Count', 'Category'. Did you mean 'Subtotal'? |
groupSort by is a typo or something else |
Use a subtotal, Count or the level's own name |
Table 'X', layout: 'detail' must be "show" (the default) or "hide" ... |
Any other detail value |
Write "show" or "hide" |
Table 'X', layout, suppressRepeats[0]: 'Categry' is not one of the columns shown on the lines. Did you mean 'Category'? |
A column that is not in columns |
Name a line column |
Table 'X', measure 'P': percentile needs "p", a number from 0 to 100, for example ... (also nthLargest needs "n", weightedAvg needs "weights") |
A function without its extra key | Add it |
Table 'X', measure 'S': 'p' is only used with 'percentile', not 'sum'. |
An extra key beside the wrong function | Remove it |
Table 'X', groupBy[0]: give exactly one of 'day', 'week', 'month', 'quarter', 'halfYear', 'year', 'weekday' ... |
A date bucket that is not one of them (the line before may say unknown field 'weeks'. Did you mean 'week'?) |
Use one |
Table 'X', derived[0]: 'previous' is true (the row before) or how many rows back to look, a whole number from 1 to 400. |
A bad previous or next (also write "rank": "desc" ... or "asc") |
Correct it |
Table 'X', tile: 'columns' is the labels across a sheet, a whole number from 1 to 12. |
A label sheet with 0 or more than 12 across (also 'rowsPerSheet' ... a whole number from 1 to 200) |
Use a value in range |
Table 'X', tile, fields[0]: no column named 'Custmer' in 'customers'. Did you mean 'Customer'? |
A label field that is not a column | Correct it |
Table 'M': a table is a 'tile', a 'pivot', a 'layout' or a 'groupBy' with 'measures', not more than one. |
Two kinds of table in one | Split it into two tables |
Parameter 'Region': the name 'Region' is also a column in 'customers'. Rename the parameter so the merge can tell them apart. |
A parameter named like a data column in any loaded table | Rename the parameter |
Parameter 'Area': 'South' is not one of the choices: 'East', 'West', 'North'. |
An item of a multiple parameter is not one of its choices |
Pick from the list |
Parameter 'Period': '2026-02-01' is not a date range. Write two dates with '..' between them ... |
A dateRange value without .. |
Write from..to |
Parameter 'Period': the range starts (2026-03-31) after it ends (2026-02-01). |
The start is after the end | Swap them |
Parameter 'Area': 'all' adds an "(All)" choice to a list, so give 'choices' or 'choicesFrom' too. |
all on a parameter with no list |
Add a list, or remove all |
Parameter 'Area': the value is too long (500 characters at most). |
A value (or joined list) over 500 characters | Shorten it |
Barcode 'Both': give 'value' (one column) or 'pattern' (text with {Column} placeholders), not both. |
A barcode with both | Keep one |
Barcode 'Bad': 'type' must be one of 'code128', 'qr'. |
A bad type (the next line may say 'value' must be a column of the data, a per-record total or a parameter ...) |
Correct it |
Barcode 'Inside': 'in' must be the name of a 'tile' table (a label sheet). This recipe has none. |
in names no label sheet |
Add the label sheet, or correct the name |
Barcode 'Scan': the placeholder {City} is not a field of the tile 'Signs'. The names are: 'PropertyId', 'Address'. |
A pattern or value for a barcode in a tile uses a column that is not in the tile's fields |
Add it to fields |
Barcode 'Scan': the placeholder {Address url} is not usable: write {Column} or {Column:url} ... |
A placeholder that is not a plain name, or has a suffix other than :url |
Write {Column} or {Column:url} |
Barcode 'Pay': 1 of 3 record(s) have no value in 'PropertyId', so they get no barcode. (warning) |
A blank value (with in: label(s) and have a blank column in the pattern) |
Fill it in, or accept no picture |
Barcode 'Name': 1 record(s) get no barcode because Code 128 holds only the ASCII characters ... (first: 'Zoë Tire'). (warning) |
A value Code 128 cannot hold | Use qr, or clean the value |
Recipe, keepRecords[0]: 'CustomerTotal' is the same for every record; use a per-record total |
keepRecords on a total that is not perRecord |
Add "perRecord": true |
Every record was skipped by the recipe's 'keepRecords' (the run stops) |
No record passes | Loosen the condition |
Link 'payments': no column named 'CustNme' in 'payments'. Did you mean 'CustName'? |
Bad link column | Correct it |
Parameter 'From': 'yesterday' is not a date, such as 2026-01-31. |
Bad parameter value | Fix the value |
Parameter 'From' needs a value (From date). |
Required and empty | Give it a value |
there is no function 'sqrt'. The functions are: round, abs, min, max, if |
Formula | Use a listed function |
no total named 'GrandTotl'. Did you mean 'GrandTotal'? |
Formula name | Correct it |
N value(s) of 'X' could not be calculated (warning) |
Divide by zero, or a missing value | Check the data |
Cross-tab 'Mix': 2 of 5 record(s) have no rows in 'transactions', so they get no table. (warning) |
A cross-tab's having (or the data) left a record with no rows |
Expected. Loosen the condition if you want them |
N value(s) in 'Amount' are not numbers and were skipped (warning) |
n/a, or $1,250.50 |
Clean the data |
Unknown token ... left unresolved (warning) |
A {{...}} or <<...>> that is not a tag, typed in template text |
Remove the braces |
N {{LinkTo}} values have no matching {{Bookmark}} ... plain text (warning) |
Dangling link | Add the bookmark |
{{Bookmark:Q:NoSuchField}}: there is no field named 'NoSuchField' (warning) |
Bad qualifier | Correct it |
16. Limits
| Limit | Value |
|---|---|
| Records in a Run tab run | 5,000 |
| Run time on the Run tab | 5 minutes. One run per person at a time; two at once on the server |
| Records in a scheduled run | 20,000, and 60 minutes |
| Speed with a chart per customer | About 4 customers per second. With no charts, 20,000 customers took about 3 minutes |
| Preview | The first 50,000 rows of each table. A real run uses every row |
| Group levels in a layout | 4 |
| Label sheet | 1 to 12 labels across; 1 to 200 rows a sheet |
| Parameter value | 500 characters (for a list, the joined text). At most 200 typed choices, and at most 500 values offered from a column |
| Barcode picture | At most 4,096 pixels wide. moduleSize 1 to 20. Code 128 height 20 to 1000. QR text up to 2,953 / 2,331 / 1,663 / 1,273 UTF-8 bytes at level L / M / Q / H. Code 128 holds ASCII only |
| Barcodes and loops | A barcode is per record or per label. Inside {{ForEach}} the record's picture repeats on every row, and a barcode for each table row is not available |
| Headers and footers | Fields, functions and {{IF}} only: no loops and no pictures. Each record gets its own only with one record per page. The add-in's Interactive mode and the Windows desktop merge do not give each record its own header, and the Windows desktop merge does not do .odt headers |
| Preview and pictures | The Preview tab does not draw QR or bar code pictures, and shows a label sheet as a table, not as pages. Look at the finished Word file |
| Table of contents | Kept as in the template, not rebuilt by the merge |
| Label sheets on paper | Checked in Word for row heights, skip and page count, not against a printed sheet of real labels. No vendor sizes are provided |
| Percentiles, rank and the like | Worked out by the recipe before the merge. A template function cannot calculate them |
| Scheduled files kept | 30 days (the history stays) |
| E-mail attachment | Up to 3 MB each |
| Bookmark name | 40 characters |
| Picture formats | PNG, GIF, BMP, TIFF, JPEG. Not SVG |
| Server runs and images | Chart pictures work. [[image]] from image libraries does not work yet |