Hello,
I am using Delphi 10.1.
There is a software package which gets data from barcode scanners. This software is not removing trailing enter characters in barcodes before inserting them in an MSSQL table. There is no way that software producer will implement such a feature in their application. It is not quite possible I talk to all clients and convince them to change their barcode scanner settings so that there will be no enter character at the end of each barcode read.
My application is importing that MSSQL table into a SQLite database table using TUniLoader. I wonder if there is a way to remove them before/during/after importation. What I am searching for is some kind of a SQL statement if it is possible. Either on MSSQL side, or in SQLite side.
Thanks.
Delete enter character(s) while importing using TUniLoader
Re: Delete enter character(s) while importing using TUniLoader
You can delete leading line breaks from the barcode value, e.g., before loading SQLite data, in the TUniLoader.OnPutData event handler:
To start data loading, call the TUniLoader.Load method. See more details about TUniLoader.OnPutData in our online-documentation: https://www.devart.com/unidac/docs/?dev ... utdata.htm
Code: Select all
procedure TForm1.UniLoader1PutData(Sender: TDALoader);
var
Row: integer;
Barcode : string;
begin
SQLServerQuery.Open;
Row := 1;
while not SQLServerQuery.Eof do begin
Barcode := SQLServerQuery.FieldByName('barcode').Value;
// add user code for removing trailing enter characters
// from Barcode variable value
...
Sender.PutColumnData('barcode', Row, Barcode);
...
SQLServerQuery.Next;
Inc(Row);
end;
end;
Re: Delete enter character(s) while importing using TUniLoader
This approach solves my problem, though Loader performance is affected negatively.
Will try to come up with an alternative solution myself.
Thanks for the example.
Will try to come up with an alternative solution myself.
Thanks for the example.