Copy extracted field value into new table

Copy extracted field value into new table

Postby jpstairs » Thu Dec 11, 2014 8:17 am

Hi,

I am new to KTM scripting in relation to tables. I want to copy an extracted field value into a new table. I searched for some samples and I thought this should do the job:


Private Sub ValidationForm_ButtonClicked(ByVal ButtonName As String, ByVal pXDoc As CASCADELib.CscXDocument)
Dim FieldValue As String

Dim Table As CscXDocTable
Set Table = pXDoc.Locators.ItemByName("NewTable").Alternatives(0).Table

Select Case ButtonName
Case "BtnExample"
pXDoc.Fields.ItemByName("IndexField").Text = FieldValue
Field_CopyToTableCell(FieldValue ,Table,"Column Name",0,True)
End Select
End Sub

Private Sub Field_CopyToTableCell(FieldText As String, Table As CscXDocTable, tableCellName As String,rowIndex As Integer, Optional CreateRow As Boolean=True)
Dim word As CscXDocWord
 
If Table.Rows.Count = 0 Then
If Not CreateRow Then Err.Raise(912,"Field_CopyToTableCell ", "cannot add cell to table with no rows")
Table.Rows.Insert(rowIndex)
End If
 
Set word=New CscXDocWord
Field_Copy(FieldText),word)
Table.Rows(rowIndex).Cells.ItemByName(tableCellName).AddWordData(word)
End Sub

But after: Dim word As CscXDocWord I get a script error: Expecting an existing scalar var

Anybody suggestions?

Best Regards,

John
jpstairs
Participant
 
Posts: 6
Joined: Wed Aug 29, 2012 5:48 am

Return to Kofax Transformation Modules General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest