· May 25, 2018

EnsLib.SQL.InboundAdapter not allowing to pull same rows when service is restarted

Has anyone used ClearRuntimeAppData,  I am using the EnsLib.SQL.InboundAdapter and pulls the SQL query fine, but if the service needs to keep pulling the same rows the next time the service is started but it will not, due to the parameter “key Field Name”

Discussion (7)0
Log in or sign up to continue

according to your description I'd  rather assume that you look for this functionality, especially concerning %LastKey

classmethod ClearStaticAppData(pConfigName As %String)

Clear static data for a config item. This is normally used to store already-processed status for input files, and other persistent values related to adapters, such as the %LastId for the SQL Inbound Adapter.


classmethod InitializeLastKeyValue(pConfigName As %String, pNewLastKey As %String = 0) as %String 

Hi Robert,

I tried the following three different ways and they did not work.

Parameter ADAPTER = "EnsLib.SQL.InboundAdapter";

Method OnInit() As %Status
   Do ..Adapter.InitializePersistentValue(..%ConfigName,"%LastKey",0)
   Quit $$$OK

Method OnInit() As %Status
   Do ..Adapter.ClearStaticAppData(..%ConfigName)
   Quit $$$OK

Method OnInit() As %Status
   Do ..Adapter.ClearRuntimeAppData(..%ConfigName)
   Quit $$$OK

You are right!  This may work only in special situations.

I reproduced your case simplified.

SQL inbound adapter keeps a list of processed ids:
if your id is in there it is skipped. Could be there is some other trick but not as in docs. 

the list looks like this

ENSDEMO>zw ^Ens.AppData("SQLservice")

Manually removing it fixed my demo.