How to force a BSI SQL Adapter to re-import old data

Document ID : KB000113091
Last Modified Date : 05/09/2018
Show Technical Document Details
Question:
Sometimes, it's necessary to force a SQL Adapter to import data again, whether because old data has been corrected or the existing raw data has been removed for some other reason. How does the Adapter know what it has already imported, and therefore how can we change that?
Answer:
Adapters track the most recently read value in the output\datasourcecontrol.xml file to make sure old values are not read twice. Here are the contents of an example file after creating the adapter:

<AdapterControl Save="end" LastSaveTime="2018/02/20 16:02:58"><Data><QueryCollection><Query QueryName="NewQuery"><KeyField Name="ref_num"><LastValue>0</LastValue></KeyField><LastFileName/></Query></QueryCollection>
    </Data></AdapterControl>


The query has one KeyField, called "ref_num". No rows have been read yet, so the LastValue is 0. After reading in and processing some rows, this will show the last (and therefore highest) value read, so the section might read

<KeyField Name="ref_num"><LastValue>10110</LastValue></KeyField>

If it is necessary to import everything again, stop the Adapter, edit that LastValue entry to go back to where the import should start, then restart the Adapter.