WORKFLOW / RELIABILITY / DATABASES

Make Sure Every Label Prints Exactly Once

Give every trigger something to remember: a row key for tables and files, a written-back "printed" mark in your own table, and an idempotency key for API calls. The write-back below was run on a real PostgreSQL through the LabelInn connector, including the case where it refuses to touch more rows than allowed.

FREE PLAN · NO CREDIT CARD · WINDOWS / MAC / ANDROID / WEB
PRINT AT THE LINELABEL IN HAND
Make Sure Every Label Prints Exactly Once — LabelInn

THE PROBLEM

A warehouse worker with a tablet next to a label printer on a cart

Automated printing has one classic failure: the same label comes out twice. A script polls the orders table and prints everything it sees. A file gets picked up again after a restart. An API call times out, gets retried, and both attempts print. Duplicate shipping labels cost money; duplicate serial labels can be a compliance problem.

LabelInn has a guard at every entry point.

Exactly once, by design. Each trigger remembers what it already printed. Start free →

01 / DUPLICATES

Database tables: a key and a mark

  • Row key. Tell the Data Source which column identifies a row (an order number, a serial). LabelInn remembers which keys it has handled and never prints the same one twice.
  • Mark as printed. After printing, LabelInn can write a value (for example printed) into a column of that exact row through the local database bridge, so your ERP and your people can see it too.
  • Only when ready. Name a column that must be filled before a row counts. A row someone is still typing waits, and prints the moment that column is filled.

02 / WRITE-BACK

Files: remembered after printing

A hot folder remembers each file by path, modification time and size. It can also move, rename or delete the file once it has printed, so it is physically out of the way.

03 / RELIABILITY

APIs you poll: a key per item

When an HTTP Fetcher node polls an external API, give it the field that identifies each item, such as order_id. Items already seen are never started again.

04 / AUTOMATION

Any source: write back the result

A Write-back node at the end of the workflow records the outcome where the data lives, for example setting status = printed. Your other systems then stop offering the record for printing at all.

05 / DUPLICATES

Tip: start on a copy

Build and test the workflow against a copy of the table, with a status or readiness column, then point it at production.

RUN ON POSTGRESQL

The write-back, step by step

A scratch table labelinn_demo_orders with four orders (one still a draft). The connector program was called exactly as the workflow's Write-back node calls it.

StepRequestResult
1. PollSELECT order_id, sku, qty FROM labelinn_demo_orders WHERE label_printed IS NULL AND status = 'paid'3 rows: SO-10442, SO-10443, SO-10445
2. Print, then mark onerow/write: set label_printed = 'printed' where order_id = 'SO-10442'rowsAffected: 1
3. Poll againsame query2 rows: SO-10443, SO-10445. SO-10442 will not be offered again
4. A mark that would hit more rowsrow/write where status = 'paid' (matches 3 rows, limit 1)ok: false, rolledBack: true, too_many_rows: "The statement would change 3 rows (the limit is 1), so nothing was changed." Poll #3 still shows 2 rows
5. Free-form UPDATE through the query endpointUPDATE labelinn_demo_orders SET label_printed = 'x'refused: sql_blocked, only SELECT/WITH queries are permitted
6. UPDATE without a conditionrow/write with an empty whererefused: "an update needs at least one condition"
7. A table name with SQL in itlabelinn_demo_orders; DROP TABLE xrefused: invalid table name
What this shows

The mark is a bound-parameter UPDATE on columns and a table you name; the number of rows it may change is capped (default 1, at most 1000) and exceeded caps roll the whole statement back. Write-back needs a database account that may UPDATE that one table, which is a different account from the read-only one used for the label query.

Run on PostgreSQL 16.14 on 17 October 2026. Oracle and MySQL use the same endpoint; SQL Server and SAP HANA were not available to test.

WHERE THE MARK LIVES

Keep the printed mark in a table you own

Matching on a stable row key and writing "printed" into your own table, not into an ERP's own tables, keeps vendor support intact; the API reference gives the same advice. Combine the mark with a readiness column in the poll query (status = 'paid' above) so half-typed rows wait.

  • Database sources and write-back need Pro ($24.90/month); the 14-day trial includes them.
  • Webhook triggers carry their own protection: a per-token flood brake of one request per 250 ms. Retries on your side still need an idempotency key, below.
  • For API calls use X-Idempotency-Key with an attempt counter (order-SO-10442:1): a repeated key returns the original job for 24 hours, but after a failed job a retry with the same key returns the failure again. See Label printing API.

QUESTIONS / FAQ

Frequently asked questions

Why do my labels print twice?

Usually because the trigger cannot tell new records from ones it already handled, for example a script that polls a table without remembering what it printed, or a retried API call. Give each trigger a key to remember and mark records as printed.

Can LabelInn mark a database row as printed?

Yes. After printing it can write a value you choose into a column of that row, through the LabelInn database bridge on your network.

What about rows that are still being typed?

Set a readiness column. A row only counts once that column is filled, so half-typed rows wait.

Does the hot folder reprint a file after a restart?

No. Handled files are remembered by path, modification time and size, and can also be moved, renamed or deleted after printing.

What stops a database row printing twice?

A poll query that skips rows already marked (WHERE label_printed IS NULL), plus a write-back after printing that sets the mark. The write-back updates only the row you name and is rolled back if it would change more rows than allowed.

Can LabelInn write to my ERP tables?

It can update the table and columns you name through bound parameters, one row at a time by default. The recommended design keeps the printed mark in a table you own rather than in the ERP's schema.

NEXT STEP / LABELINN

Print once. Only once.

Put the guard at the trigger, not in someone's memory. · Row keys remembered · Rows marked as printed · Readiness checks

Start free →