XMLPort: Import file with header

dreamteam
Member Posts: 5
Hello,
I have a file wich the first line is the Header of the fields. I have to skip the first line but i don´t know how to do this.
I just tried to create a Element Table: <Integer>(Integer) with the SourceTableView: SORTING(Number) WHERE(Number=CONST(1)), like the standard does, but doesn't work. At first i had one error "Integer number '0' alredy exists¡ wich i solved with this code line on the trigger Import::OnBeforeInsertRecord():
Integer.DELETEALL;
But now give's me another error:
"The element <tagname> is expected by min occurs value: Once, Element received <tagname2>"
Somebody knows how to solve this? I'm really frustrated.
Thank you very much.
I have a file wich the first line is the Header of the fields. I have to skip the first line but i don´t know how to do this.
I just tried to create a Element Table: <Integer>(Integer) with the SourceTableView: SORTING(Number) WHERE(Number=CONST(1)), like the standard does, but doesn't work. At first i had one error "Integer number '0' alredy exists¡ wich i solved with this code line on the trigger Import::OnBeforeInsertRecord():
Integer.DELETEALL;
But now give's me another error:
"The element <tagname> is expected by min occurs value: Once, Element received <tagname2>"
Somebody knows how to solve this? I'm really frustrated.
Thank you very much.
0
Comments
-
Hi dreamteam,
You're not the first to ask. Search for "XMLport skip header" and find valuable posts, like this one: Import dataport and skipping the header line.0 -
Thanks Ivanvugt,
I've alredy tried this, but is just for old nav version Dataports, not XmlPorts:
IF CurrDataport.IMPORT THEN BEGIN
REPEAT
CurrFile.READ(cha);
UNTIL cha = 10; // of course in case the RecordSeparator is "<<NewLine>>"
END;
I'm using Nav 2013, and CurrDataport, CurrFile and the function READ doesn't exist. I have searched for a long time on mibuso and other sites, but nothing.
Thanks.0 -
I'm still stuck0
-
The only clue I have is open the file in OnPreXMLport trigger (using currXMLport.FILENAME property), copy it and remove the first line in the copied one; after that overwrite currXMLport.FILENAME with new file and process it.
Hope it helps.* Daniele Rebussi * | * Rebu NAV Diary *0 -
Hi dreamtteam
Sometimes you are better off using xmlDOM, meaning you don't use xmlPort but do it all manually. You have to decide if the business case does legitimate this non standard approach, but you get full control of the parsing process, also validitating against schemas and all this stuff.
Btw: This applies to XML files, not for flat files imported with xmlPort.
Hope this helps.
Thomas0 -
________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions