Skip to content

ERP: Number Documents gives each document in a table the next number of its series, with no gaps and no number given twice. A document keeps its number: when the same document comes through again, in this run or a later one, it gets the number it already has. Use it before posting when the documents need numbers that the ERP doesn’t assign, such as invoice numbers that must run without gaps.

A series is identified by its key alone, across the whole workspace: every step that uses the same series key, in any project, draws from the same series. Key each series per company and environment, such as PROD:1000.

The General tab has four sections.

  • What to do — the Action: Issue numbers, Release numbers of failed documents or Roll a series back.
  • Documents — the Table of documents, its Series column (series_key when left blank) and its Document column (document_key when left blank). A document key identifies the document across runs: rows that share one get one number. Rows with no series or no document key are left out, with a warning that counts them.
  • Seed — the Seed table, with the columns series_key and last_value.
  • Output — the Result table, with one row per document: series_key, document_key, number and status.

Each document that has no number yet gets the next number of its series, in order of document key. A document that already holds a number keeps it, with the status kept; a new number has the status issued.

A series starts from a seed. Until a series is seeded, it issues nothing: its documents get the status not_seeded, and a warning says to add the series to a seed table. In a seed table, last_value is the number last handed out, so the first number issued is the one after it, and 0 starts the series at 1. A seed only moves a series forward:

  • A series that already issued past the seed is kept where it is, with a warning.
  • A seed above where the series stands moves it up to the seed, with a warning: another system handed out the numbers in between, and they are never issued here.

A seed row with no last_value, or one that isn’t a whole number, is skipped with a warning, and so is a series that appears in the seed table more than once.

Release takes back the numbers of documents that failed and won’t be presented again, so the next documents issued reuse them. Only the end of a series can be taken back:

  • Of the documents in the table, the one holding the series’ last number is released, with the status released, then the one holding the number below that, and so on down, while each holds the last number left.
  • A number below another document’s number stays with its document, with the status not_tail, and a warning counts those documents. Presenting that document again reuses its number; if it is never presented again, its number is a gap.
  • A number at or below the series’ seed is never released.
  • A document with no number has the status not_issued.

Release the same documents every time the step runs: a number that stayed because others held numbers after it is released once those are. Never release a document that may still have posted, or one that failed once and posted later. Release doesn’t read the seed table.

Rolling back hands a series back to the system it came from. It reads only the Seed table, where last_value is the highest number that posted. Every number above it is voided, with the status voided, and the series is removed, so it issues nothing until it is seeded again. The numbers up to last_value stay on record.

  • A blank last_value rolls the series back to its seed.
  • A last_value below the series’ seed is skipped, with a warning, because the seed was set or raised after the last number posted.
  • A series this workspace doesn’t have is skipped.

Stop every run that uses the series before you roll it back.

The step follows the run’s posting mode:

  • Live issues, releases or rolls back for real.
  • Simulate works out the same result and keeps none of it. An issued number shows as would_issue, with the number a Live run would give, and a number a release would take back stays kept. A rollback lists the numbers it would void as voided, and its warning says they would be voided. Warnings about what a Live run would change start with Simulate:.
  • Off skips the step.

A Table or Seed table that isn’t there, or that lacks one of the columns the step reads, isn’t an error: the step skips it with a warning that names it, and issues nothing for it. A table with no documents finishes with a warning, too.