mibuso.com

Microsoft Business Solutions online community
It is currently Wed Jun 19, 2013 3:48 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 2:00 am 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
Hey guyz,

I created a dataport to import some information from a csv file.

It creates a No. for the record but it doesnt import any of the information. All the fields are left blank.

I tried debugging it, it doesnt seem to read any of the information from the excel file. All the fields from the excel file are blank in the debugging mode.

I have created all the variables in the C/AL Global, and Dataport fields. I have set import to yes, FileFormat to variable, FieldSeperator to , ,Record and dataitem seperator to NewLine. I have set AutoSave, AutoUpdate, and AutoPrelace to YES.

I dont know what else I could be missing. All the code I have written is in OnAfterImportRecord.

Any idea why it might be doing wrong since it doesnt seem to read the csv file???
Code: Select all
CLEAR("Fixed Asset");
"Fixed Asset".INIT;
"Fixed Asset"."No." := "No.";
"Fixed Asset".Description1 := Description1;
"Fixed Asset"."Description 2" := Description2;
"Fixed Asset"."Serial No." := "Serial No.";
"Fixed Asset"."Office No." := "Office No.";
"Fixed Asset"."Make/Brand Name" := "Make/Brand Name";
"Fixed Asset"."Model No." := "Model No.";
"Fixed Asset"."Responsible Employee" := "Responsible Employee";
"Fixed Asset"."FA Class Code" := "FA Class Code";
"Fixed Asset"."Cost Center Code" := "Cost Center Code";
"Fixed Asset"."Shortcut Dimension 7 Code" := "Shortcut Dimension 7 Code";
"Fixed Asset".INSERT(TRUE);


Top
 Profile E-mail  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 2:47 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
Is importing one line or no lines just to clarify. What trigger of the data port do you have that code on. Check the keys of the table your importing to so you know your covering all the "main" fields /ie "line no."

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 2:53 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
I also see in your code your simply assigning an imported value to nav fields without using VALIDATE to fill in the values.

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 2:55 am 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
The csv file has alot of line. Each line in the csv file is one record.

Trigger - OnAfterImportRecord()

The Table key is "No." field. What would I have to with the key field of the table??

I have to validate the values...i didnt know that. The last dataport I created, i never validated all the values and the dataport worked fine.


Top
 Profile E-mail  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:16 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
When I create a dataport I import all fields into variables and map them back to nav fields.
I import them in the order you would naturally manually enter them. Validating where needed. You can always throw a message on the code , say after you get the " no." fields throw MESSAgE('%1',"no.");
To see if it's even picking up the value. Then that helps you find the problem. It will either be while importing or after importing. Then you can narrow you focus.

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:20 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
You also say you don't validate, even in the past. The best check I can do to find out if a data port is working 100% is to import 1 line. Then manually enter one line. View the table for those two lines , they should one on top of another. If the data port is filling all the fields just like the manual entry then you can start feling good about the port.

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:25 am 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
Thats the thing, the dataport is not picking up the values from the csv file. It leave all the fields blank. Even when I try to debug the code, all the variables are blank even when its is in the OnAfterImport trigger.

I am not sure why they are blank.

I took out all the other lines from the CSV file except one and its still empty. It creates a Job No. for that line. But the rest of the line is blank. None of the information gets imported.


Top
 Profile E-mail  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:50 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
Try losing the insert( true).
Since I can't See i have ask if you've filled in the data port fields.
You also say it finds nothing then you said it imported just the "no."
Please be specific on exactly what's happening

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:56 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
Are you importing into your own global variables and mapping back?

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 3:59 am 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I got rid of the True, and still nothing.

No. field is increment using a No. Series. Before a record gets inserted into the database, it has its own unique No.

Each line in the CSV file will have a unique No. field (this will help us differentiate between different records).

After the unique No. has been created using the No. Series, information from the CSV file is suppose to be assigned to different variables in that table.

I have created global variables and I am mapping back to them.


Top
 Profile E-mail  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 4:02 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
Are you sure your getting the number series properly? Search the forum for " dataport number series" for examples.
Also, make sure your trigger you are using is correct and nothing on the others

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 4:06 am 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
The No. series is working fine. Its creating a new (unique No.) for each line in the csv file. Its just not copy the information from the file and inserting it in the table.


Top
 Profile E-mail  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 4:12 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
Try changing
"Fixed Asset"."No." := "no.";
To "Fixed Asset".validate(No.",yourNOvariable);
Do you get a message?

Also in your code I see nothing about getting a number series? Why?

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 4:27 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
I'm not at a computer right now so it's hard to visualize the fixed assets table.
You said you've made data ports before, with what I told you you should be able to figure out the problem.
[-o<

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


Top
 Profile E-mail WWW  
 
 Post subject: Re: Dataport not bring any data???
PostPosted: Thu Mar 29, 2012 4:42 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6990
Location: L.I., New York
Country: United States (us)
nverma wrote:

The Table key is "No." field. What would I have to with the key field of the table??
.

I don't understand what you are asking here. You do realize when importing into a table filling the key fields is a big deal. You need to validate more. Check the application designers guide that comes with the product. It has a section on dataports.

_________________
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  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 23 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: