Deleting a batch from VB

Deleting a batch from VB

Postby TheOrbix » Thu Apr 05, 2012 2:08 pm

Hello,

I'm working on a custom VB app that will delete all batches of a certain class from a Kofax installation.

Now, the code should look somethink like this:

Code: Select all
   
    'get list of all batches in system
    Set m_oBatches = m_oRuntimeSession.BatchCollection(KfxDbSortOnPriorityDescending, , , True)

    'Delete all batches of my custom class
    For Each m_oBatch In m_oBatches
        If m_oBatch.BatchClassName = "mycustomclass" Then
            m_oBatch.BatchOpen (????)
            m_oBatch.BatchDelete
        End If
    Next


Problem is, what should I pass to the BatchOpen() method?

The documentation simply says that it should be a long varilable:

The lRequestingProcessID is the process requesting the lock. For custom modules, it would be the custom module ProcessID.

My application is an custom VB application, how can I retrieve the ProcessID for my application?
TheOrbix
Participant
 
Posts: 25
Joined: Sat Jan 21, 2012 2:14 am

Re: Deleting a batch from VB

Postby bclaman » Fri Apr 06, 2012 4:24 am

not sure why you need to open the batch to delete it ... but just dim L as long and then set L=1 and pass L in. It shouldn't matter if all they want is a long.
bclaman
Participant
 
Posts: 258
Joined: Thu Sep 24, 2009 10:00 am
Location: Des Moines, IA

Re: Deleting a batch from VB

Postby mark.ortiz@capitalcapture.com » Fri Jun 15, 2012 6:57 am

'for each' can be a bit flakey. (you possibly should put a "mashal.releasecomobject(m_oBatch)" on the line before Next)

I've noticed in Kofax's sample custom module code, they use .BatchOpen and then .BatchOpenNext for the rest (see Processor.vb)
mark.ortiz@capitalcapture.com
Participant
 
Posts: 43
Joined: Tue May 01, 2007 7:45 am
Location: London (UK)

Re: Deleting a batch from VB

Postby aadslingerland » Sat Jun 16, 2012 3:11 am

mark.ortiz@capitalcapture.com wrote:you possibly should put a "mashal.releasecomobject(m_oBatch)" on the line before Next


Assuming TheOrbix uses VB.NET instead of VB6...
With Regards, Aad Slingerland
User avatar
aadslingerland
Participant
 
Posts: 299
Joined: Tue Sep 22, 2009 12:23 am

Re: Deleting a batch from VB

Postby David » Wed Jun 27, 2012 12:54 pm

bclaman wrote:not sure why you need to open the batch to delete it ...

I was thinking this was a way to create a batch history entry, but I must admit this is mostly a guess.
If you make it idiot-proof, someone will make a better idiot.
User avatar
David
Participant
 
Posts: 1512
Joined: Wed Dec 07, 2005 4:08 am

Re: Deleting a batch from VB

Postby Warpfield » Tue Jul 17, 2012 9:00 am

mark.ortiz@capitalcapture.com wrote:'for each' can be a bit flakey. (you possibly should put a "mashal.releasecomobject(m_oBatch)" on the line before Next)

I've noticed in Kofax's sample custom module code, they use .BatchOpen and then .BatchOpenNext for the rest (see Processor.vb)


Placing a GCCollect(objectname) at the end of the ForEach fixes the Garbage Collector issue:

foreach (ACDataElement abc in DocumentColl)
{
//Do stuff
}
GCKeepAlive(DocumentColl);
If they are going to hate you anyway for what you do, then you might as well put forth your best effort.
User avatar
Warpfield
Participant
 
Posts: 62
Joined: Tue Apr 10, 2007 8:11 am


Return to Custom Modules General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests