In my past datacap projects the requirement was to arrange the several page types in a batch in a specific order. Because it was not possible to have the right order before scanning or importing them into the batch. As datacap have no option to do this you need to create a custom action that does the work. In the following I will show you how to easy it is to deploy this action and use it in your environment.

My action was made with VBScript so you simply need to open a text editor e.g. notepad++ and paste the following sample code in it.

<?xml version='1.0' ?>
<rrx namespace="SortPages" v="8.0.0"><i ref="rrunner.rrx"/><g>
<![CDATA[
'*********************************
'TIMETOACT group (C) 2019
' Version
'  1.0.0 - 02.09.2019 - Benjamin Just
'
'*********************************
]]></g>

<f name="SortPages" access="public" qi="Uses the OrderString to sort all pages in the required order">
<p name="OrderString"/>
<ap>
Komma separierte Liste der Sortierreihenfolge der Seiten<br/>
</ap>
<h>
z.B: Bestellung,Frontansicht,Grundriss,Perspektive<br/>
<e>
SortPages("Bestellung,Frontansicht,Grundriss,Perspektive"<br/>
</e>
Copyright (c) 2019 by Benjamin Just - TIMETOACT
</h>
<lvl>
Batch level
</lvl>
<ret>
<br/>
<b>True</b>
</ret>
<see>
<br/>
<scr></scr>
</see>
<g>
<![CDATA[
'Your VBScript code goes here.

Dim FieldAr
Dim FieldIndex
Dim i
dim j
dim l
FieldAr = Split(OrderString,",")

Dim Pagecount

Pagecount = CurrentObj.NumOfChildren
Pagecount = Pagecount - 1

Writelog("Pagecount " & Pagecount)
For j = 0 to uBound(FieldAr) step 1
	Writelog("Fieldart: "  & FieldAr(j))
	
	For i = 0 to Pagecount step 1 
	Writelog("DokArt: " & CurrentObj.GetChild(i).Type)
	If CurrentObj.GetChild(i).Type = FieldAr(j) Then
				
				Writelog("Move: " & CurrentObj.GetChild(i).Type)
				Call CurrentObj.MoveChild(i ,l)
				l = l+1
			End if
	next

next
]]>
</g>
</f>
</rrx>

Save this action as <YOURFILENAME>.rrx and copy it into you applications rules directory.

Now you can access this action in DC Studio in the “Application specific actions”

The Orderstring parameter of the action defines the sort order of the page types. E.g. if you have the page types Invoice, Order, Contract the action will sort all pages of the same type in this order.

The rule must run on batch level

Leave a Reply

Your email address will not be published.