Request a demo

Number documents automatically by client - in a workflow

A practical approach when working with many different clients: Number documents consecutively and - as an example - per vendor for incoming invoices. The easiest way to do this: set up a workflow that is triggered automatically every time a new document is stored. 
DocuWare is completely multi-client capable. This means you can serve multiple vendors, customers or partners within a DocuWare system – without any of them being able to view the data of the other. In order to keep track of the documents for each client, it‘s a good idea to number them separately and consecutively. 
To do this, you set up a simple workflow that assigns each invoice per client with a consecutive number from a client specific number range. While DocuWare's standard file cabinet settings offer the option to enter a number range, in this case you’ll want to specify one range per client. Once the workflow for numbering documents per client has been set up, you can copy it for each new vendor or customer and further customize it. 
As a trigger for the workflow, you can set it to start when a specific company name is found during document storage.
To set up the numbering
You basically need to follow two steps to create a workflow for number ranges. We‘ll demonstrate them here using the example of numbering a vendor‘s incoming invoices: 
1. First, you set up five variables that are used to determine the vendor and anticipated types of documents.
2. Then you fill these variables with values into four data assignments. 
1. Create variables 
You create a total of five variables. These are filled in our example in the order they are listed here:
  • DocID (Type: Integer) for the new document number. Each document stored in DocuWare automatically receives a document ID, which is a unique number for each file cabinet.
  • Client (Type: Text) for the client or company name. This variable is filled together with DocID in our example.
  • Previous DocID (Type: Integer) for the previous document number.
  • Previous invoice number (Type: Integer) for the last invoice number. 
  • Invoice number (Type: Integer) for the new invoice number.

To learn about how variables work in a workflow and how to create variables, click here.

2. Fill variables in data assignments

To fill the variables, you simply assign data to them. Start by dragging the Assign data activity as a step in your workflow. In total, you create four such successive data assignments, with two variables being filled in the first. A dialog opens in which you can specify the individual data assignments in more detail. The values that you assign to the variables here are of course examples - which you can use depending on your application. 
With the first data assignment, under Set variables, you determine which document should be used for numbering. To do this, you fill the variable DocID with the document ID from the document’s index entries and Client with the company name of the client.
Dokumente nummerieren_EN_1
In order to assign a new number within the number range to exactly this document, first search in the second data assignment for the last stored document of this number range - then store its document ID in the field for PreviousDocID. To do this, you first select a variable as target. Select File cabinet as entry type.
Dokumente nummerieren_EN_2
Then determine the entry with an SQL command, for which the following WHERE clause is used in the example: DW_Company = 'GV_Client' AND DW_DocID < > GV_DocID
Dokumente nummerieren_EN_5 
In the third data assignment, in Get previous invoice number, you let the workflow know which number in the number range was assigned last. To do this, fill the field Previous invoice number with the corresponding value from the file cabinet. In our example, the document number is used as invoice number. With the SQL command, the workflow then knows from which number in the number range it should continue counting.
Dokumente nummerieren_EN_3
In this example, the WHERE clause DW_DocID = GV_Previous DocID is used for the SQL command.  
Dokumente nummerieren_EN_6
In the fourth data assignment, here as Set new invoice number, you ensure that the number range is always incremented by the value 1. To do this, fill the corresponding index entry (here the document number) with an arithmetic expression: for example, GV_Previous invoice number + 1.
Dokumente nummerieren_EN_4
Learn more about how to set up and use workflows to improve all your business processes.