Problem with dataport and general journals

poppins
Member Posts: 647
Hello Everybody !
This is my first post in this forum. I'm a beginner in using Microsoft Dynamics Nav and unfortunately I'm facing now problem. I used a Dataport which load lines from an Excel file to the general journals table.
My problem is that, when examining the inserted values on the table, I found that there is noi value in the field "Document Type" and that the value of the field "Amount" is 0.
What can I do to fix it???
Here is the code of the Dataport, if needed:
This is my first post in this forum. I'm a beginner in using Microsoft Dynamics Nav and unfortunately I'm facing now problem. I used a Dataport which load lines from an Excel file to the general journals table.
My problem is that, when examining the inserted values on the table, I found that there is noi value in the field "Document Type" and that the value of the field "Amount" is 0.
What can I do to fix it???
Here is the code of the Dataport, if needed:
Documentation() G/L Entry - OnPreDataItem() G/L Entry - OnBeforeExportRecord() G/L Entry - OnAfterExportRecord() G/L Entry - OnBeforeImportRecord() G/L Entry - OnAfterImportRecord() "Gen. Journal Line".INIT; "Gen. Journal Line".VALIDATE("Journal Template Name","Gen. Journal Line"."Journal Template Name"); "Gen. Journal Line".VALIDATE("Journal Batch Name","Gen. Journal Line"."Journal Batch Name"); "Gen. Journal Line".VALIDATE("Line No." ,"Gen. Journal Line"."Line No." + 10000); IF "Gen. Journal Line".INSERT(TRUE) THEN "Gen. Journal Line".SetUpNewLine("Gen. Journal Line",Balance,FALSE); "Gen. Journal Line".VALIDATE("Posting Date",DateCompt); "Gen. Journal Line".VALIDATE("Document Type","Type Document"); "Gen. Journal Line".VALIDATE("Document No.",FORMAT(DocNum)); "Gen. Journal Line".VALIDATE("Account Type","Gen. Journal Line"."Account Type"::Customer); "Gen. Journal Line".VALIDATE("Account No.","N°Client"); "Gen. Journal Line".VALIDATE("Gen. Journal Line".Description,Désignation); //"Gen. Journal Line".VALIDATE(Amount,Montant); "Gen. Journal Line".VALIDATE("Amount (LCY)",Montant); "Gen. Journal Line".VALIDATE("Document Date","Date Document"); "Gen. Journal Line".VALIDATE("External Document No.","N° Documentf"); "Gen. Journal Line"."Bal. Account Type":="Gen. Journal Line"."Bal. Account Type"::"G/L Account"; Customer.GET("N°Client"); "Groupe Compta":=Customer."Customer Posting Group"; "Customer Posting Group".GET("Groupe Compta"); "Gen. Journal Line".VALIDATE("Bal. Account No.","Customer Posting Group"."Receivables Account"); "Gen. Journal Line".MODIFY(TRUE); DocNum += 1; G/L Entry - OnPostDataItem() ImportDataPar(NomF : Text[250];NomModFeuille : Code[10];NomFeuille : Code[10];DateComptabilisation : Date;"N°Doc" : Code[20]) FileName:=NomF; "Gen. Journal Line"."Journal Template Name":=NomModFeuille; "Gen. Journal Line"."Journal Batch Name":=NomFeuille; DateCompt:=DateComptabilisation; "N° Document":="N°Doc";
0
Comments
-
In fact, the DataItem of the Dataport refers to the G/L Entry table...but in the Dataport's code, the General journals table is used.
I don't understand why...can't that be the source of the errors??????0 -
You will have to use Gen. Journal Line as dataitems and then write the code for validation.
Regards,
Faisal Bukhari0 -
thank you for your reply....but what validation code???
Isn't the validation taking place in the Dataport code???0 -
Yes,
Change your dataitem to the correct one & re-try your code.
Note: The best way to see if a dataport is working correctly is to manually enter a line into the journal, filling in the info you normally do. Then you can look at the table and see all the fields that get filled.
When you run your dataport all the same fields should be filled else your dataport is missing something.0 -
I tried to change the DataItem but got an error...in fact, the property DataItemTableView is set to SORTING(No. Series)...and the field No.Series doesn't exist for the Gen. Journal Line table...so what field should I use instead????0
-
Why do you need any view in a dataport? leave it blank0
-
I don't really know....In fact I got the code and I was asked to correct it as an exercise....I started dealing with Nav 2009 only two weeks ago....0
-
more dataport info:
http://msdn.microsoft.com/en-us/library/dd301300
Read more about dataports in the application designers guide. (w1w1adg.pdf)
http://www.microsoft.com/en-us/download ... x?id=24432
If it's just an exercise for 2009 - the best answer would be to delete the dataport & start learning XML ports.0 -
I wish it was possible....My manager is insisting on the use of DATAPORTS... ](*,) ](*,) ](*,)0
-
poppins wrote:I wish it was possible....My manager is insisting on the use of DATAPORTS... ](*,) ](*,) ](*,)
For a dataport you need to just select the table you want to import into.
Map the fields to match your incoming data.
Manipulate the data if needed during import.
No Dataitemviews or stuff like that needed. That's more for a form.0 -
Here's a GJL dataport sample - using a datafile of just 4 fields to import.
It's for importing credits so if you build this one & run the data - then view the results it might give you an idea on how the dataport works. Good luck
https://docs.google.com/document/d/1ESb ... PeQwM/edit0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions