problem in Data Conversion – Lab 6 of solution developement

SimoGsi
Member Posts: 23
Hello ,
i wanna import a file <toto.txt> in <Gen. Journal Line> table before posting the whole data to the Ledger table.
for that i create a dataport including the following triggers :
OnPredataItem
LOCKTABLE;
SETRANGE("Journal Template Name",'VENTES');
SETRANGE("Journal Batch Name",'DEFAUT');
IF FIND('+') THEN
NextLineNo := "Line No." + 10000
ELSE
NextLineNo := 10000;
OnBeforeImportRecord
INIT;
"Journal Template Name":='Sales' ;
"Journal Batch Name" :='DEFAUT' ;
"Account Type":="Account Type"::Customer ;
"Document Type":="Document Type"::Invoice ;
OnAfterImportRecord
VALIDATE("Document Type") ;
VALIDATE("Account No.") ;
VALIDATE("Posting Group");
"Line No." := NextLineNo;
NextLineNo:=NextLineNo+10000 ;
here is a sample file that i wanna to import
31669966 Meersen Meubelen 83209187 06/01/99 07/01/99 127.5 Widgets 44100
This dataport work fine with no bug but when i open <Gen. Journal Line> table, i find it empty.
what is wrong with my Dataport????!!
Thank in advance.
i wanna import a file <toto.txt> in <Gen. Journal Line> table before posting the whole data to the Ledger table.
for that i create a dataport including the following triggers :
OnPredataItem
LOCKTABLE;
SETRANGE("Journal Template Name",'VENTES');
SETRANGE("Journal Batch Name",'DEFAUT');
IF FIND('+') THEN
NextLineNo := "Line No." + 10000
ELSE
NextLineNo := 10000;
OnBeforeImportRecord
INIT;
"Journal Template Name":='Sales' ;
"Journal Batch Name" :='DEFAUT' ;
"Account Type":="Account Type"::Customer ;
"Document Type":="Document Type"::Invoice ;
OnAfterImportRecord
VALIDATE("Document Type") ;
VALIDATE("Account No.") ;
VALIDATE("Posting Group");
"Line No." := NextLineNo;
NextLineNo:=NextLineNo+10000 ;
here is a sample file that i wanna to import
31669966 Meersen Meubelen 83209187 06/01/99 07/01/99 127.5 Widgets 44100
This dataport work fine with no bug but when i open <Gen. Journal Line> table, i find it empty.
what is wrong with my Dataport????!!
Thank in advance.
Navision
0
Comments
-
Make sure you have a Journal Batch Name called "Defaut". I guess your template is based on your language?
In English we use: Journal Template Name="GENERAL", Journal Batch Name = "DEFAULT".
Maybe you have missed the L in DEFAULT?
Go to General Ledger, General Journals, choose the DEFAUT batch (or you can create it if it does not exist). Then create a blank row and zoom on the record (Ctrl + F8), look at the value of the two fields mentioned above.
My guess is that the data is there if you look in the table, but the template or batch might not exist.
Regards,
gus0 -
Hello all,
First of all thank you for your advices.
effectively the "Journal Template Name" contains "ventes" as a value and "Journal Batch Name" the contain 'DEFAUT' as a value.
but the problem persist.
Really i dont know what to do????!!
Any other advice!
:roll:
Thank youNavision0 -
Since you are doing an init, you might need to do an insert.
So even after looking at the table itself, you do not see any records?0 -
First of all, I think you use the wrong trigger; try to place your code in OnAfterImportRecord.
:P In my opinion, any manual placed code deactivates automatic actions by Navision, so: If you want to import, tell him: Your last statement should be INSERT;
Will it work now?
Regards
Michael
0 -
Thank you for advice,
It is working fine now
I inserted the follwing code in
OnAfterImportRecord (trigger)
// INIT;
"Journal Template Name":='VENTES' ;
"Journal Batch Name" :='IMPORT' ;
"Account Type":="Account Type"::Customer ;
"Document Type":="Document Type"::Invoice ;
VALIDATE("Document Type") ;
VALIDATE("Account No.") ;
VALIDATE("Posting Group");
"Line No." := NextLineNo;
NextLineNo:=NextLineNo+10000 ;
But Why OnAfterImportRecord trigger and not using the init instruction?!!!
All the documentation and the examlpe given in the documentation said that i ve to put the code on OnBeforeImportRecord and i should use the init to initialize the records.
Can you please explain me more????!!!
Thank you very much!!!Navision0
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