Hello
Can anyone point me toward export script example on how to push document fields to ODBC database, please?
I tried to find anything in documentation - but unfortunately, failed.
Just simple script to on how to push one field and handle an error exception will be sufficient.
Thank you in advance
Comments
5 comments
There is an article and sample provided in the ABBYY knowledgebase titled "Using Custom Export in Flexicapture Projects". It doesn't export to ODBC, but it does provide a sample on how to identify fields and export them. The sample would need to be modified to export to ODBC.
Hi Adrian,
Thank you for your reply. My issue I don't know how to work with ODBC in FlexiCapture.
I presume normal way it done in Visual Basic is not applicable ? (I'm not an expert in VB):
'------------------ here is example I found on internet--------------------
Set WSNet = CreateObject("WScript.Network")
varUserName = WSNet.UserName
'varUserdomain = WSNet.UserDomain
'varNBName = WSNet.ComputerName
Set WSNet = Nothing
Set MyConn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.Recordset")
MyConn.open = "DRIVER={SQL Server};"_
& "SERVER=SQLSERVER;"_
& "DATABASE=PKTime;"_
& "OPTION=35;"
sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedIn" & "' WHERE LoginID ='" & varUserName & "'"
'ex: sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedIn" & "' WHERE LoginID ='" & "PaulK" & "'"
'ex for logout: sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedOut" & "' WHERE LoginID ='" & varUserName & "'"
'ex: sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedOut" & "' WHERE LoginID ='" & "PaulK" & "'"
MyConn.Execute sql_query
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
First, the sample you found is VBScript, not VB.NET. And you do not want to do it this way as it leaves the code open to SQL Injection attacks. A better example is here: http://stackoverflow.com/questions/12634516/how-can-i-insert-data-into-sql-server-using-vbnet
Second, do you have a reason for wanting to do this in a custom script? You can configure an export to an ODBC database in the "Document Definition > Export Settings" with no custom code required.
What version of Flexicapture are you using?
Hi Adrian
I'm quite new to Flexicapture.
It's 11.04 Standalone.
I just need push line items to ODBC database, not the rest of the fields, and process rest of the fields into custom formatted XML file. I done the XML part already, now looking into line items.
Ok, you should then be able to set up a second export to ODBC for the detail lines. I would suggest only trying to custom script when absolutely necessary.
Document Definition > Export Settings > Add > Export to ODBC ... use the appropriate OLE DB provider. The setup wizard will let you configure what fields you want to export, and what tables to map them to.
I hope this was helpful.
Please sign in to leave a comment.