mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 19, 2013 4:01 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 11:21 am 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
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:
Code: Select all


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";



Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 2:49 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
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??????


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 3:29 pm 
Offline

Joined: Fri Sep 25, 2009 6:33 am
Posts: 48
Location: Mumbai, India
Country: India (in)
You will have to use Gen. Journal Line as dataitems and then write the code for validation.

Regards,
Faisal Bukhari


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 3:37 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
thank you for your reply....but what validation code???
Isn't the validation taking place in the Dataport code???


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 4:31 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
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.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 4:54 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
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????


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 5:48 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
Why do you need any view in a dataport? leave it blank

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Last edited by Savatage on Thu Jun 21, 2012 5:53 pm, edited 2 times in total.

Top
 Profile E-mail WWW  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 5:51 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
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....


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 5:54 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
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. :mrgreen:

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 6:04 pm 
Offline

Joined: Thu Jun 21, 2012 11:13 am
Posts: 266
Country: France (fr)
I wish it was possible....My manager is insisting on the use of DATAPORTS... ](*,) ](*,) ](*,)


Top
 Profile E-mail  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 6:10 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
poppins wrote:
I wish it was possible....My manager is insisting on the use of DATAPORTS... ](*,) ](*,) ](*,)

Fine then go step by step and work your way through it.

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.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Problem with dataport and general journals
PostPosted: Thu Jun 21, 2012 6:39 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
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/edit

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: