Not a valid object reference

Not a valid object reference

Postby » Tue May 19, 2015 12:12 pm

I'm getting this error.

How do I reference a fieldname like so?

batchfilename = Split(pXDoc.Fields.ItemByName("FilePath").Text,"\",8)
Participant
 
Posts: 108
Joined: Tue Dec 17, 2013 2:09 pm

Re: Not a valid object reference

Postby » Wed May 20, 2015 6:44 am

Little more info... I'm new to KTM ;-)

Trying to switch capture validation script over to KTM.

I'm starting off trying to do a sub to view code actions.

It's just not working...

Code: Select all
Sub main
   Dim batchfilename As String
   Dim pointer As Integer
   Dim acctnumber As String
   Dim DOL As String
   Dim DOL2 As String
   Dim strDay As String
   Dim strMonth As String
   Dim strYear As String

   batchfilename = InputBox("enter text")
   batchfilename = Split(batchfilename,"\",8)
   batchfilename = Left(batchfilename, Len(batchfilename)-4)
   MsgBox "batchfilename:" &batchfilename


   pointer = InStr(batchfilename,"_")
   acctnumber = Left(batchfilename,pointer-1)
   MsgBox "acctnumber" &acctnumber

   DOL = Mid(batchfilename,pointer+1)
   DOL = Left(DOL,pointer-1)
   strDay = Mid(DOL , 1, 2)
   strMonth = Mid(DOL , 3, 2)
   strYear = Mid(DOL , 5, 4)
 
   DOL2 = strYear & "/" & strDay & "/" & strMonth
   MsgBox "DOL" &DOL2

End Sub


Any help would be great. Thanks.
Participant
 
Posts: 108
Joined: Tue Dec 17, 2013 2:09 pm

Re: Not a valid object reference

Postby » Wed May 20, 2015 11:43 am

twildt wrote:How do I reference a fieldname like so?

batchfilename = Split(pXDoc.Fields.ItemByName("FilePath").Text,"\",8)


Well, first off, you'll have to populate the field FilePath. It doesn't automatically flow from Capture field. There's other posts here on how to do that.

Secondly, "Split" has a different syntax. It returns an array. If I read it right, it would be

batchfilename = Split(pXDoc.Fields.ItemByName("FilePath").Text,"\")(8)
Russell
Participant
 
Posts: 3374
Joined: Wed May 17, 2006 12:53 pm
Location: USA


Return to Kofax Transformation Modules General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest