Dataport

We have a problem using dataport. When creating a report, we use DataItemLink to combine two or more tables. But how do we combine two tables when using dataport?

You cannot link DataItems in dataports using properties. I’m sure you can use C/AL Code to do what you want.

Maybe a very simple solution is to create a report and save that report as a HTML file. In you’re report you only place the fields you need. The file you can read in Excel and export to CSV file. Not the perfect way but easy. Not the best, but fast learning

fenja, can you be more specific what you need the dataport for? By definition dataports are made to exchange large quantities of data at once. A structure of data is usually not required. Example: Sales orders and sales order lines: It wouldn’t matter to export first all Sales orders and in the second run (thus same file) the lines. Marcus Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

Fenja. As Marcus said you can also have multiple Data Items. If it was the Sales Header and Lines you could copy the filters on PreDataItem If you want to have one line with information from two tables then you need to look at using a report and opening a file. Look at Reports 91 and 92 for Examples If you still are having problems give more details on what you are trying to achieve. David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

I would like to know how to export both sales headers and lines using a dataport. However, I would like to only export sales headers 3, 5, and 8. How do you control exporting the sales lines related to 3, 5, and 8 headers? DataItem 1 = Sales header DataItem 2 = Sales Line Thanks. Brandon Taylor btaylor@proteantech.com

quote:


How do you control exporting the sales lines related to 3, 5, and 8 headers?


SalesLine.OnPredataItem: “Document No.”.SetFilter(SalesHeader.Getfilter(“No.”) However I wouldn’t be happy with this solution: The export file would contain header 3 header 5 header 8 line 3,10000 line 3,20000 etc. Not so nice structure for an importing program. I would recommend to use a nonprinting report in this case instead of a dataport. Probably I’m wrong but I don’t like Dataports so much. In my eyes they are only suiteable for a quick-and-dirty save/restore for masses of data. Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

The question you should ask (your customer) is “For what do you need this multi-table export?” Simply because there will be a reason for wanting to export data. Transfer to another database? Import in Excel for analysis? Make a printed catalog? Your export format should fit the import capabilities of “the other side” and very often it is the Navision side where the flexibilty has to be, as the receiving party is rigid in format or structure. That’s no problem, Navision is flexible with import and export, but there are several way to accomplish the task. For large chunks of data to/from a single table, Dataports can be handy, but when the needs are more specific (multiple tables, structure, formatting, etc.) other methods like batch processing reports may be better. John

I too require to do a similar job as Brandon, but I will be bringing sales order information into Navision. The question that I have is : Based on other developers experience, what is the best way to deal with multiple line imports? I realise that multiple tables and dataports do not like to work hand-in-hand, so what other alternatives work best ?

You can do that in Solutions (or at least using 2.65 C/SIDE). Dataport is now able to export XML file using links like in reports.

Dean, there are many ways to get the task done. But what’s the best way depends on a couple of things. Like the structure and format of the files(?) you get to do the import from. What volume of orders is to be processed? How many times a day? What business rules have to be applied before and order is accepted and entered in to the system? As rule of thumb, I would advise you to find a way to get the raw data transferred into Navision as quickly as possible and then start the processing part. Because once you’ve got the data in the database, things will become much easier to control. Doing checks, applying filters, running validation routines and so on- it’s far more easy to do that from one table to another than trying to squeeze everything into the first import step. Make a few extra tables where you can transfer the import data to in the most convenient way. Not only easier to program the import routines, but also a separation of the real order tables. The actual import, as said, can be done im several ways, i.e. by a straight forward dataport, or a processing report, or even by a codeunit where you tweak and twiddle up the byte level. Which one to use? That’s mainly depending on what you get as data to import. When you could give us a little bit more insight on this, a more detailed advise might be given. John

Hi Fenja, you can use variables instead of table field names in the dataport fields selection window, e.g. if you want to export customer + bank account infos in one line you can use the dataitem customer and append a few variables to the dataport field list. All you have to do is assign the appropriate values to the (defined) variables in the OnBeforeExport Trigger which means you have to get the bank infos manually: bank.setrange(Customer.“Nr.”); if bank.find(-) then… Thats it. For import cou can use the AfterImportTrigger and do a manual split to several tables. Dont forget to set the dataitem properties AutoUpdate,AutoReplace, AutoSave accordingly. Bye, Torsten Edited by - todro on 2001 Mar 13 19:32:53

Hi, In Attain 3.10A, in a new dataport, I’ve G/L Account as my dataitem. In properties, AutoSave=Yes,AutoUpdate=No,AutoReplace=No. I’ve tried to import a record A in a text file into database B. The record A in the text file was exported from database A. Record A exists in database A but doesn’t exist in database B. When I tried to import the text file into database B, an error “G/L No. 1400 does not exist.” was displayed. Can anyone help ? Thnx in advance.

Check dataport properties into database B. If AutoSave=Yes then you should import without problems. Check CallFieldValidate property of Field designer into dataport. It’s new in Attain. Cheers!!!

GARCIA : The CallFieldValidate property is also available in the NF 2.60 I currently use. ###### tarek_demiati@ureach.com