I have a basic XMLPort to import a CSV file into the General Journal Line (81) BC table. This is working fine if I manually remove the header line at the top of the file.
I've seen various web-pages that say you can do something like the code below to skip the first line of the import-file. However, it still evaluates the data in the line instead of ignoring/skipping the line. It's reporting: "The length of the string is 21, but it must be less than or equal to 10 characters. Value: Journal Template Name".
1. Declare a global Boolean var (e.g.)
var
bFirstLine: Boolean;
2. trigger OnPreXmlPort()
begin
bFirstLine := true;
end;
3.
trigger OnBeforeInsertRecord()
var
begin
if bFirstLine then begin
bFirstLine := false;
currXMLport.Skip();
end;
end;
Am I using the wrong event perhaps? Any help would be greatly appreciated. Here's a sample of the data:-
Please verify the solution if it worked, so others can benefit from this thread..
Great.
Wow! That was quick. All fixed. Many thanks for your prompt response.
Hi,
Can you try this?
trigger OnInitXmlPort()
begin
firstrow := true;
end;
trigger OnAfterInitRecord()
begin
if firstrow then begin
firstrow := false;
currXMLport.Skip();
end;
end;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156