Use expressions in a workflow configuration

Prev Next
This content is currently unavailable in German. You are viewing the default (English) version.

Expressions are formulas or code snippets used to perform calculations, manipulate data, or automate tasks within a workflow. They can be written in languages like Visual Basic for Applications (VBA) and .NET, and may include specific customizations for DocuWare.

By embedding expressions in a document-based workflow, you can dynamically generate values, validate data, or create conditional logic based on the content of the documents.  This enables more sophisticated and automated processing.

Refer to the notes on Workflow Expression Parser for full information about the capabilities of expressions in a DocuWare Workflow.

The Expression Dialog

In DocuWare Workflow Designer a specific dialog is available for using arithmetic expressions.

This dialog is available for example in the actions Assign data or conditions.

To add a variable to an expression, first select the tab for the group of variables you want: System variables, Global variables, Index tables, or Form fields. Click the variable or field you want on the tab.

The tabs and variables available to you vary according to the function used or the settings in the activity concerned.

Aligning tables with expressions

Compare different table sources based on expressions. This helps eliminate potential errors during the digitization of invoices or other documents.

Examples:

  • Following expressions compare two strings and estimate their similarity:

    • Peter Peterson _~ Peter Pitersen = 93%

    • S523-A336MS ~ S523-A336M5 = 95%

  • These expressions modify a string according to a pattern:

    • Remove all numbers from a string according to a pattern
      \d:Something123Anything => SomethingAnything

    • Split an input string using the following pattern:
      \d+:Something123Anything => Something, Anything

  • Check if a string matches the pattern:

    • [A-Z0-9]\d{3}-\d{3}:
      A123-456 => true

Using expressions in DocuWare index tables

You can use values from index tables in the expressions. If you access a value from a column of the same index table that you want to edit, you will get exactly one value, namely the value from the same row. To do this, select the column from the "<Table name> cells" tab.

On the other hand, if you access an index table column of another table, you will get a list of all values in that column. To do this, select the column from the Table columns tab.

It is possible to read the value from another column of the same table, transform it by expression if necessary, and then write it to the destination column. For more information, see Editing the values of single columns.

Inserting the "Line number" system column

The DocuWare column "SYS_ROW_NUMBER" returns the number of the respective row of an index table, which you can use to concatenate values, perform calculations, or retrieve a value from another table in the same row. The first row of a table is always considered as row number "1".

This is especially important if you are working with an indexer to determine a line, because there the count starts at 0.

However, if you use the "SYS_ROW_NUMBER" system column, counting starts at 1. So to get the same line you have to subtract 1 > "...[SYS_ROW_NUMBER]-1".

For example:

You are editing a table called "Example" (internal name "EXAMPLE") and want to insert values from another table called "New Items" (internal name "NEW_ITEMS") into the "Name" column. The searched values are located there in the "New Name" column (internal name "NEW_I_NAME").

You use an indexer to determine the values and the "SYS_ROW_NUMBER" system column to assign the values.

Normally, you define the following arithmetic expression for the destination column:

DW_NEW_ITEMS[NEW_I_NAME](X)

This returns the value of the "New Name" column of the "New Items" table in the specified row. "X" specifies which entry from the list you want to return. Since the indexer starts at 0, "0" means the first line, for example.

Now you need the value from the same row in the source table for the fields in the destination table. Therefore, you do not use a fixed value for the indexer, but use the new system column "SYS_ROW_NUMBER".

The problem with this is that if you use only the "SYS_ROW_NUMBER" system column, you will not initially get the desired row:

DW_NEW_ITEMS[NEW_I_NAME](DW_EXAMPLE[SYS_ROW_NUMBER])

This expression returns the value of the next row in the "New Name" column of the "New Items" table. This means that if, for example, the first row of the "Line Items" table is processed, the value of the second row of the "New Items" table is returned.

This is because "[SYS_ROW_NUMBER]" returns the value "1" and the effective expression is then DW_NEW_ITEMS[NEW_I_NAME](1).

To get the correct value of the same row you have to subtract 1 from the "SYS_ROW_NUMBER" system column.

DW_NEW_ITEMS[NEW_I_NAME]((DW_EXAMPLE [SYS_ROW_NUMBER]-1))

Sys Row

This returns the value of the same row in the "New Name" column of the "New Items" table.

This means that if, for example, the first row of the "Example" table is processed, the value of the first row of the "New Items" table is returned.

This is because "[SYS_ROW_NUMBER]-1" returns the value "0" and the effective expression is then DW_NEW_ITEMS[NEW_I_NAME](0).