Options

Dataport Item unable to Ident in V4 SP3

edisonledisonl Member Posts: 25
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

Comments

  • Options
    SavatageSavatage Member Posts: 7,142
    you can't indent in a dataport like a report - you can use a "get" to get the proper table & insert your records.
  • Options
    colingbradleycolingbradley Member Posts: 162
    Use all variables for the import, the Dataport Fields.

    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
    Experience is what you get when you hoped to get money
  • Options
    edisonledisonl Member Posts: 25
    Use all variables for the import, the Dataport Fields.

    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
    1 Destination, Multiple Route
  • Options
    edisonledisonl Member Posts: 25
    Savatage wrote:
    you can't indent in a dataport like a report - you can use a "get" to get the proper table & insert your records.
    Thanks for replying.. the 'funny' thing here is that only insertion into Journal Line table will be able to successfully perform all records insertion, I tried to insert coding to perform insert into 2 Journal Dimension Line records into Journal Line onAfterImport Record section. However the first record will always go 'missing' (Eg: 5 records, first records cant be inserted into Journal Line Dimension)

    Regards
    1 Destination, Multiple Route
  • Options
    colingbradleycolingbradley Member Posts: 162
    I do not understand how you are missing anything.
    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';
    Experience is what you get when you hoped to get money
  • Options
    edisonledisonl Member Posts: 25
    I do not understand how you are missing anything.
    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
    1 Destination, Multiple Route
  • Options
    edisonledisonl Member Posts: 25
    edisonl wrote:
    I do not understand how you are missing anything.
    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
    1 Destination, Multiple Route
  • Options
    wassim81wassim81 Member Posts: 2
    edited 2010-09-13
    how i can add
  • Options
    vaprogvaprog Member Posts: 1,130
    Wassim81, please do not hijack a thread, especially if your question is not or only very lightly related to the existing thread.

    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.
  • Options
    wassim81wassim81 Member Posts: 2
    thanks
Sign In or Register to comment.