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.
0
Comments
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.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
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.
Hope it helps.
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.
Thomas
http://www.dynamics.is/?p=1405
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com