Advanced Transition Conditions

Therefore™ Workflows contain transitions between different tasks in a process. Conditions can be set on these transitions so the workflow will only proceed down that path if certain criteria are fulfilled. For example, you can set a condition to check if a document with the same index data already exists in a category.

This tutorial covers advanced scenarios which involve querying the Therefore™ database.

Note:

Examples included in this tutorial are based an SQL database. If you are using another database brand, you must adjust the syntax to suit your database type/version.

Samples

Document with the same index data in one category

The following conditions check whether a document with the same index data already exists in a category.

  1. Copy
    EXISTS (SELECT NULL FROM TheCatXXX c WHERE c.<col1> = TheCatXXX.<col1> AND c.<col2> = TheCatXXX.<col2> AND c.DocNo <> TheCatXXX.DocNo)

    This will return TRUE regardless of the number of existing documents. If no document with the same index data exists, it will return FALSE.

  2. Copy
     1 = (SELECT count(*) FROM TheCatXXX c WHERE c.<col1> = TheCatXXX.<col1> AND c.DocNo <> TheCatXXX.DocNo)

    This will return TRUE only if there is one document in the category with the same index data.

  3. Copy
    (SELECT count(*) FROM TheCatXXX c WHERE c.<col1> = TheCatXXX.<col1> AND c.DocNo <> TheCatXXX.DocNo) >= 2

    This will return TRUE only if there are 2 or more documents in the category with the same index data

Legend:
XXX is the ID of the category.
<col1> and <col2> are the column names of the index fields to be checked.

Document with the same index data in two categories
Copy

Pre TF 2015

[Info] is not NULL and EXISTS (Select NULL from TheCat551, TheCat622 as Source where Source.DocNo = TheCat622.DocNo and Source.Info = TheCat551.Info)

 

Copy

TF 2015+

[Info] is not NULL and EXISTS (Select NULL from TheCat551, TheCat622 where TheCat622 .DocNo = T0.DocNo and TheCat622 .Info = TheCat551.Info)

Legend:
[Info] is the index data field to check for.
TheCat551 and TheCat622 are the tables to check (source and target table).
TheCat622.Info and TheCat551.Info are again the index data fields to check.
T0.DocNo or TheCat622.DocNo is needed to restrict to the current document.

Document is present in another category

The following condition checks whether a document is present in another category within the same case.

Copy

Pre TF 2015

(SELECT COUNT(0) FROM dbo.TheCat609 cat WHERE cat.CaseNo = dbo.TheCase23.CaseNo) > 0 

OR

Copy
EXISTS (SELECT NULL FROM TheCat609 WHERE TheCat609.CaseNo = TheCase23.CaseNo)

 

Copy

TF 2015+

(SELECT COUNT(0) FROM dbo.TheCat609 cat WHERE cat.CaseNo = T0.CaseNo) > 0

OR

Copy
EXISTS (SELECT NULL FROM TheCat609 WHERE TheCat609.CaseNo = T0.CaseNo)

Legend:
609 is the ID of the category.
23 is the ID of the case definition.
T0.CaseNo or TheCase23.CaseNo are needed to restrict to the current case.

Check if a multi-keyword field is empty

The following condition checks whether a multiple keyword field is empty or not.

Copy
(SELECT count(*) FROM TheDocuKeyXX WHERE DocNo=T0.DocNo)>0

This will return TRUE if at least one keyword is stored in the multiple keyword field and FALSE if the field is empty.

Legend:
XX is the ID of the Keyword used in the category.