General Journal Dataport Question

gadzilla1gadzilla1 Member Posts: 316
Hello all,

I've set up a simple import dataport to table 81 Gen. Journal Line. The dataport fields line up with corresponding fields in a .csv file.

The only code I've added is in the OnAfterImportRecord() and that is this:

"Journal Template Name" := 'GENERAL';
"Journal Batch Name" := 'CHRIS';

Here are my questions:

1 - I use the dataport and everything is imported appropriately to the correct fields without error. I open up the General Journals form and the dataport results show up. Everything posts without error. However, when I run the table after the dataport I see that for the dataported irecords the Debit Amount and Credit Amount fields are not populated (I've dataported to Amount values of -10 and 10 in two different records). As a test, when I enter/key in the same values for the dataported items and then run the table, I see a value of -10 in Debit Amount and 10 in Credit Amount automatically. Is this an issue? If so how do I remedy this?

2 - Also how do I account for dimensions in the dataport - salesperson code, region code, etc.

Thank you for any help in this matter. Have a great day. gad1

Comments

  • DenSterDenSter Member Posts: 8,305
    When you manually enter values, the system always runs the validation trigger. When dataporting records in, this does NOT always happen, even when you set the validate property to yes.

    You naad to make sure that your dataport validates the field values. My standard approach with dataports is always to import into variables, and program the data myself. This takes a little more time, but has given me the only way to predictably import data correctly.
  • gadzilla1gadzilla1 Member Posts: 316
    Thank you.

    In my case would I just be validating the Amount field variable in the OnAfterImportRecord() area? If you have a simple example it would be greatly appreciated.

    gad1
  • SavatageSavatage Member Posts: 7,142
    you mean like:
    VALIDATE(Amount);

    I have a dataport to for that Journal, looks like

    OnPreDataItem()
    "Posting Date" := TODAY;
    "Journal Template Name" := 'PURCHASES';
    "Journal Batch Name" := 'METREC';
    "Document Type" := 3; //I know I shouldn't use the #
    "Bal. Account No." := '50300'; //it just for 1 thing so it's set in stone
    "Account Type" := 2; //I know i shouldn't use the #
    "Line No." := 10000;
    

    OnAfterImportRecord()
    Vendor.GET("Account No.");
     IF Vendor.Blocked
    THEN BEGIN
     CurrDataport.SKIP;
    END
    ELSE BEGIN
     VenNo := "Account No.";
     MonthName := FORMAT(TODAY,0,'<Month Text,3><Year>');
     "Document No." := VenNo+'-'+MonthName;
     "Line No." := "Line No." + 10000;
     VALIDATE("Account No.");
     Description := 'MetRec Purchase Returns';
     CreditCount := CreditCount + 1;
    END;
    

    *I have never needed to validate the amount for whatever reason but just add it in there if you need to.

    OnPreDataport()
    CreditCount := 0;
    

    OnPostDataport()
    CurrFile.CLOSE;
    IF CONFIRM('%1 Credits Imported / Would You Like To Delete The File?',TRUE,CreditCount) 
     THEN ERASE(CurrDataport.FILENAME);
    
    gadzilla1 wrote:
    2 - Also how do I account for dimensions in the dataport - salesperson code, region code, etc.
    Is the csv file giving you this info or does it get filled in "regularly" if you manually enter it?
    If the csv gives it then just assign the values to it's fields
    If it's normally filled in when you manually enter a line then you dataport isnot validating all the proper fields.

    As Daniel said if you import them into variables then you map them to their correct Nav field and vaidate them in the same order as you would manually enter a journal line.
Sign In or Register to comment.