Print formats that read other records
Part 5 of 7 · 7. Manifests
Back: Register books, limited fields and your Desk pageNext: Worked example
Print formats that read other records: ivn_rows and ivn_value
A print format of yours may show more than its own record (a price list printed with each item's price and photo) through two readers, with the rights of the person viewing the print: ivn_rows(record_type, fields=…, filters=…, order_by=…, limit=…, start=…) (up to 200 rows a call, 50 unless you set limit) and ivn_value(record_type, field=…, name=… or filters=…). Use them as the way to read other records; this is guidance, not a guarantee about every template a site holds. The arguments and refusals are on the template readers page.
- Who reads as whom. Opened in Desk, or downloaded with a user's API key: what that user may read. A portal account: what it may read (usually nothing). A share key, a published form, a visitor, a print rendered as another user, and one rendered later from the e-mail queue or a background print: nothing. A print sent inside the sender's own request carries the sender's view: an e-mail sent at once, Send Now on a queued one, a notification's subject and message, a bulk print of up to 25 records, and the till's e-receipt when no notification is linked to it. Write a template meant to be sent so that it reads well with its related rows empty.
- What they read: record types of the iVendNext layer, the engine and the POS app, and your package's own record types (with the viewer's rights, while the app is installed; not a table, settings or virtual type, nor one holding a password). Not another record's table rows; Address, Contact, File, Currency and Country are refused, so for a customer's address on a print use the document's own display fields. A refused read answers an empty list and the print still renders.
- The checker refuses a print format that runs the raw database query, the query builder or an outside fetch, one that loads anything from an outside address, and template syntax inside an address the print loads unless the whole value is one plain reference such as
{{ photo }}or{{ row.image }}. It warns on any other way of reading records, and on the till's partner-code helper (which prints with no rights check), namingivn_rows. It refuses a row or value read of a record typeivn_rowsserves, or of one of your own manifest's record types it will serve once installed, made through the framework's own readers (itsget_all,get_listanddb.get_value,db.get_all,db.get_listwith the record type written as a quoted first argument or a quoteddoctype=): read it throughivn_rowsorivn_value, or show the printed record's own fields. The list of served types is the product's (PRINT_SERVED_TYPESin the checker). A read of another package's type stays a warning, and so do these, becauseivn_rowshas no replacement for them: a type it does not serve (Address, Contact, a child table such as a draw's Winner rows, a settings record), a whole-record read, a render, a map, a count, and a read whose type is built, aliased, subscripted or named by a later keyword. The kit's checker refuses what the retailer's install refuses, in the same words: it is the same checker, copied. The checker reads text: six known ways around it pass, so it is a tripwire, not a control.
Back: Register books, limited fields and your Desk pageNext: Worked example