Skip to main content

Notifications

Small and medium business | Business Central, N...
Unanswered

xmlport import csv

Posted on by 670

I have a CSV file as below and I'm trying and failing to import it into BC table: "Gen. Journal Line" (81) using an XmlPort.

"GENERAL","DEFAULT","TLPUK0099","","","95.460","01/01/2018"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","","-5.370","31/01/2018"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","REVERSING ENTRY","5.370","01/02/2018"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","","-8.500","28/02/2018"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","REVERSING ENTRY","8.500","01/03/2018"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","","-5.760","10/10/2019"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","","-5.760","10/10/2019"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","REVERSING ENTRY","5.760","01/05/2019"
"GENERAL","DEFAULT","TLPUK0099","Revalued Source","REVERSING ENTRY","5.760","01/05/2019"

Here's my XmlPort:-

xmlport 50000 XmlPortGenJrnl
{
Format = FixedText;
Direction = Import;
TextEncoding = UTF8;
UseRequestPage = false;
TableSeparator = '';

schema
{
textelement(Root)
{
tableelement(GenJournalLine; "Gen. Journal Line")
{
XmlName = 'GenJnlLine';
fieldelement(JournalTemplateName; GenJournalLine."Journal Template Name") { }
fieldelement(JournalBatchName; GenJournalLine."Journal Batch Name") { }
fieldelement(AccNum; GenJournalLine."Account No.") { }
fieldelement(Description; GenJournalLine.Description) { }
fieldelement(DocumentNo; GenJournalLine."Document No.") { }
fieldelement(Amount; GenJournalLine.Amount) { }
fieldelement(PostingDate; GenJournalLine."Posting Date") { }

}
}
}

var
myInt: Integer;
}

When I call XmlPort.Run(50000, false, true); in a Page extension action, I get error: Posting Date must have a value in Gen. Journal Line: Journal Template Name=, Journal Batch Name=, Line No.=0. It cannot be zero or empty.

Where am I going wrong? Any help would be greatly appreciated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans