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

30 thoughts on “Rearrange pages in datacap batch

  1. I needed to thank you for this fantastic read!! I definitely loved every bit of it. I have got you book marked to check out new stuff you post…

  2. Tried Motioneye and even MotioneyeOS, but had a horrible time trying to get Logitech Webcams (2 models) to be detected correctly.

  3. Aw, this was a really nice post. Spending some time and actual effort to make a superb article… but what can I say… I procrastinate a lot and don’t manage to get nearly anything done.

  4. Thanks for another fantastic post. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such info.

Leave a Reply

Your email address will not be published. Required fields are marked *