Hi there
I have picked up strange behaviour on XMlPorts when importing a TAB delimited text file when using <None> as the FieldDelimiter and <NewLine> as the RecordSeparator.
My test import file has 3 columns and 3 rows and it looks like this:
A1 "B1", C1
A2 "B2", C2
A3 "B3", C3
I have created a Dataport that imports the file without problems but when trying to create an XMLPort that imports the same file the XLMPort does not recognise the linefeed/character return value in the file and it only imports the first line.
Please can I ask you to take a look at my XMlPort and tell me whether you know of a property that I have missed or a setting that I can use to replicate the behaviour of the Dataport?
My two NAV objects are shown below. You can add the XMLPort to a Page Action to run it from the RoleTailored client - neither of these two import functions actually import any data at this point, it's just a test and the import functions display a MESSAGE dialog after importing every line to show the data imported into the 3 different columns.
NAV Objects:
OBJECT Dataport 99012 Import Tab Delimited File
{
OBJECT-PROPERTIES
{
Date=29/05/12;
Time=08:57:43 AM;
Modified=Yes;
Version List=IMPTABFILE1.0;
}
PROPERTIES
{
FieldStartDelimiter=<None>;
FieldEndDelimiter=<None>;
FieldSeparator=<TAB>;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table2000000026;
AutoSave=No;
AutoUpdate=No;
AutoReplace=No;
OnAfterImportRecord=BEGIN
Value1 := ColumnA;
Value2 := ColumnB;
Value3 := ColumnC;
Value4 := '';
END;
}
FIELDS
{
{ ; ;ColumnA }
{ ; ;ColumnB }
{ ; ;ColumnC }
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
}
}
CODE
{
VAR
ColumnA@1000000000 : Text[30];
ColumnB@1000000001 : Text[30];
ColumnC@1000000002 : Text[30];
Value1@1000000003 : Text[30];
Value2@1000000004 : Text[30];
Value3@1000000005 : Text[30];
Value4@1000000006 : Text[30];
BEGIN
END.
}
}
OBJECT XMLport 99012 Import Tab Delimited File
{
OBJECT-PROPERTIES
{
Date=29/05/12;
Time=09:51:57 AM;
Modified=Yes;
Version List=IMPTABFILE1.0;
}
PROPERTIES
{
Direction=Import;
Encoding=UTF-8;
OnPreXMLport=BEGIN
ImportCounter := 0;
END;
Format=Variable Text;
FieldDelimiter=<None>;
FieldSeparator=<TAB>;
RecordSeparator=<NewLine>;
UseRequestForm=No;
}
ELEMENTS
{
{ [{9EB37C52-4B99-4A66-B412-8F4824F27F07}]; ;Root ;Element ;Text }
{ [{7749CBA2-87B1-45A4-859B-96F1F655C1FF}];1 ;Import ;Element ;Table ;
SourceTable=Table2000000026;
Temporary=Yes;
LinkTableForceInsert=No;
Import::OnBeforeInsertRecord=VAR
lvTempAccNo@1000000004 : Code[100];
lvTempICCode@1000000003 : Code[100];
lvDaytxt@1000000002 : Text[30];
lvMonthtxt@1000000001 : Text[30];
lvYeartxt@1000000000 : Text[30];
lvAmountDec@1000000005 : Decimal;
lvDimValue@1000000006 : Record 349;
BEGIN
ImportCounter += 1;
Integer.Number := ImportCounter;
MESSAGE(ColumnA, ColumnB, ColumnC);
END;
}
{ [{9DDAAE0A-DD30-44C4-96D7-12CD375AE4A1}];2 ;ColumnA ;Attribute;Text ;
Width=1024 }
{ [{F4615471-47B9-4B84-9168-EAB400C9CE5B}];2 ;ColumnB ;Element ;Text }
{ [{4993A052-32AD-48A6-B50D-1C27D550B5C7}];2 ;ColumnC ;Element ;Text }
}
EVENTS
{
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
}
}
CODE
{
VAR
ImportCounter@1000000000 : Integer;
BEGIN
END.
}
}
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Is there another way to upload objects other than to try and add them as part of the post using the "Upload attachment" section at the bottom?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n