Posted Mon, 25 Sep 2023 18:50:51 GMT by Nathan Koskey Business Analyst
In my invoice workflows I have some logic that looks for duplicate invoices and marks them as such to take them out of workflow. This works really well except for one scenario. 

I have a vendor that frequently sends me a packet with 100 or more invoices. About half of those invoices are duplicates of themself within the same packet. (we've asked them to stop but they are technically challenged and can't) The logic checks all invoice information, then checks to see if all of that info already exists but with a different DOC_ID. If it does, then its a duplicate. When these invoices hit workflow the duplicates show the exact same store timestamp down to the milliseconds. They go through workflow at the same rate and are both flagged as duplicates. The only difference is the Doc_ID and they are consecutive.  If I could split the timing up for even a few seconds it could fix the check. 

I had an idea to create a time delay that leveraged a variable. The variable could be right() populated with a Doc_ID that is multiplied by a number. So far all of my attempts to do anything with the Doc_ID have failed. I have tried the various data types and cannot get the arithmetic expression to validate. All I want is 'right(DW_DWDOCID,3)2' and for it to be numeric so I can use it with the time delay.

Does anyone have a suggestion? Am I completely doing this wrong? Thank you!
Posted Tue, 26 Sep 2023 12:29:27 GMT by Gerardo Lisanti Team Leader Product Management
Hi Nathan,

the trick here is to first convert the DWDOCID to a string (CStr) in order to use the Right() function and then convert it back to integer (CInt).
So the correct expression is: CInt(Right(CStr(DW_DWDOCID),3))*2

Example: For DOCID "10516" it will return "516*2" so "1032"

Hope this helps!

Viele Grüße / With best regards,
 
Gerardo Lisanti
Team Leader Product Management  |  DocuWare GmbH
Posted Tue, 26 Sep 2023 14:16:23 GMT by Nathan Koskey Business Analyst
Excellent, that worked for me.

GV_DOCID_ADJ = CInt(Right(CStr(DW_DWDOCID),3))*3

GV_DOCTIME = DateAdd(DateInterval.Second,GV_DOCID__ADJ,WF_START_DATETIME)

Time Delay Activity: GV_DOCTIME

The goal is the two identical documents enter workflow at the same time, same info. The only difference is the DocID. This will leverage the DocID to create a number that is different enough that I can use it to manipulate a time variable. Then apply that variable to the timer activity.

Example: For DOCID "10516" it will return "516*3" so "1548"

That document will then add 1548 seconds to the current time and wait. This allows workflow enough of a time difference to not treat them the same.

You must be signed in to post in this forum.