Posted Tue, 23 Oct 2018 13:37:02 GMT by Nathan Wilkins

Afternoon,

Has anyone used a COUNT Statement within a Workflow, can it be done?

I am trying to fill a varible with a count of documents that have the same index information in a File Cabinet based on a document type within a Workflow to give me a numeric number. 

Can this be done?

 

Kind Regards,

Posted Tue, 23 Oct 2018 13:51:14 GMT by Phil Robson DocuWare Corporation Senior Director Professional Services, Americas

Nathan,
SQL queries are limited to the WHERE part of a query. I think the solution for you is to call a web service.

 

Phil Robson
Senior Director Support Americas

Posted Fri, 25 Nov 2022 15:00:09 GMT by Pedro E. Gonzalez-Santini
Hello. I have the same need. Does the Workflow Manager now in version 7.7 allow this without a web service?  If not, can you provide a bit more detail on how the web service would work? This is for a Cloud installation. Best regards.
Posted Tue, 29 Nov 2022 15:55:25 GMT by Gerardo Lisanti Manager Product

Hi Pedro,

you can do this by retrieving the entries in the file cabinet with a suitable WHERE statement.
The steps are to find the entries, temporarily store the DOCIDs in a global variable, and then count the entries in the global variable.
However, since retrieving the entries from file cabinets is limited to 100, this only works if you want to count up to 100 (see example below)

Example: Count the documents with "Document Type" = "Invoice In" and return the number to a global variable MyCount.
Perform following steps in a workflow wihtin the Workflow Designer:

  • Create a global variable of type Keyword, e.g. MyKeyword
  • Create a global variable of type Integer, e.g. MyCount
  • Add an Assign Data activity
  • There add a new assignement
    • Choose destination global variable MyKeyword
    • Choose source File Cabinets
    • Select the file cabinet and the field, e.g. DOCID
    • Specify the WHERE clause, e.g. DOCUMENT_TYPE = 'Invoice In'
    • Set the "Maximum number of returned documents" to "100"
  • Add a second assignment
    • Choose destination global variable MyCount
    • Choose source Arithmetic Expression
    • Use expression: Count(GV_MyKeYword)

For more informations on the Workflow Expressions see: https://go.docuware.com/workflow-expression-parser


If you want to count more than 100, you will need to solve this via a web service request from the workflow to any middleware, which takes the request from the workflow, does the count and returns the result to the workflow.

You can do this for example using an iPaaS platform such as make.com.

  • Set up a new scenario and add "incoming webhook", where you send the request from the workflow.
    • You'll get a URL which has to be registered in the DocuWare system as a web service.
  • In Workflow Deisgner add a web service activity and configure the request to the the registered web service.
    • Within the request you could for example also provide the values which should be searched for (HTTP Query or Body)
  • Once the request is received by iPaaS platform, use the DocuWare connector to perform the search (search for documents).
  • After that send a "webhook response" including the count result (total_number_of_bundles) from the DocuWare connector back to the workflow.

For more information on the DocuWare connector on Make.com see: https://www.make.com/en/help/app/docuware​​​​​​​

​​​​​​​
Viele Grüße / With best regards,
 --
Gerardo Lisanti
Product Manager  |  DocuWare GmbH

You must be signed in to post in this forum.