Hi Everyone,
1.I have created a dataport to import csv file.
2.Main table of importing records into payment journals, with
sub tables in Journal Dimension Line.
3.So for every Payment Journal insert, I'll need to create 2 records in Journal Dimension Line
(Shortcut Dimension 3 Code:STAFF & Shortcut Dimension 4 Code:Department as Dimension Code & Dimension Value to be populated from csv file, Template & Journal name from Payment Journal)
4.Though I tried to 'squeeze' all insertion coding into Payment Journal OnAfterImportRecord, the first record of department & staff values is not being populated into Journal Dimension Line table.
5.So I tried to work around by using 2 dataitems, First:for payment journal, Second:for Journal Dimension Line with Second Link to first by Template Name & Batch Name, but was prompt with error on file format not save as UPXML.
6.Again there was another attempt to circumnavigate the situations via no identation of second data item:Journal Dimension Line, this time round, the Journal Dimension Line doesnt run at all(I tried to display message in AfterImportRecord for Journal Dimension Line) but there was no use.
1 Destination, Multiple Route
0
Comments
http://www.BiloBeauty.com
http://www.autismspeaks.org
Use code to insert the data to the journal and at the same time to the Journal Line Dimension.
That way you can check all data before insert.
Forget about actually directly importing to the journal table, use a variable for the Gen. Journal Line.
Anyway, this is how I always do it.
Cheers,
Colin
Dear Colin,
I did a variable insertion in data Item variable and do necessary validation in onAfterImport Record section, but it seems but Journal Dimension Line doesnt work.
Pardon me I like to clarify does your methods works in single data item- Journal Lines or 2 Data Items as in Journal Line & Journal dimension Line ?
Cheers
Regards
If you use the VALIDATE option for the dimensions that is all you need to do I would have thought.
"Journal Template Name" := 'GENERAL';
"Journal Batch Name" := 'CORRECTION';
"Line No." := LineNo;
VALIDATE("Account Type","Account Type"::"G/L Account");
VALIDATE("Account No.",AccNo);
VALIDATE("Posting Date",Pdate);
"Document No." := DocNo;
Description := 'Rev.' + Desc;
VALIDATE(Amount,Amnt);
IF Dim1 <> '' THEN
VALIDATE("Shortcut Dimension 1 Code",Dim1);
IF Dim2 <> '' THEN
VALIDATE("Shortcut Dimension 2 Code",Dim2);
"Source Code" := SrcCode; ///'GENJNL';
Dear Colin,
Thanks for the tips, I forgotten to mention that its the Shortcut Dimension 3 & 4 Code that I like to insert my Department & Staff Code/Values into.
Regards
Dear Colin,
Manage to settle it already, I used Clear() thats all.
Regards
To answer your question: You need to be able to define an unambiguous record separator in order to be able to use a dataport. If this is not possible you either need to preprocess your import file, or you need to import it some other way (i.e. coding it in C/AL using file operations...).
A dataport always considers each line of the import file to be one record. You can alter the definition on "line" by setting the RecordSeparator property.