Manual · API

# `reports`

Printing goes through reports — the ones you designed, so there is one printing engine, not two.

Every command on this page carries a worked example.

###
print function

`reports.print("Name", records, options)`
the records to print are fetched

Prints a report over the records you hand it.

Hand it a query's `.all()` for form letters — and if the user should choose the report, open `reports.openManager(records)` instead of guessing for them.
Worked example

    // The button on the invoice window:
    reports.print("Invoice", [form.record]);
    // A form letter over a query's answer:
    const dunned = database.invoices
        .where("isPaid", "=", false)
        .where("dueDate", "<", new Date());
    reports.print("Reminder", dunned.all());

###
openEditor function

`reports.openEditor(records, "Name")`

The report editor, on the records you hand it — where a report is designed and adjusted.

Worked example

    const dunned = database.invoices.where("reminderLevel", ">", 1).all();
    reports.openEditor(dunned, "Reminder");

###
openManager function

`reports.openManager(records)`

The report window your end user picks from — the same one a list's Print action opens.

Worked example

    // The same window the list's Print action opens:
    reports.openManager(form.list.shown);