Dataport question...

kirkostas
Member Posts: 127
Hi,
I want to import three fixed length Ascii files into three tables Vendor, Customer and Item. Can I have one dataport with a custom request form to achieve this?
Is it possible?
I want to import three fixed length Ascii files into three tables Vendor, Customer and Item. Can I have one dataport with a custom request form to achieve this?
Is it possible?
kirkostas™
0
Comments
-
kirkostas wrote:Hi,
I want to import three fixed length Ascii files into three tables Vendor, Customer and Item. Can I have one dataport with a custom request form to achieve this?
Is it possible?
Why not?
Dataport can export/import more than one table. Need just add to options form case and export/import in compliance with it.0 -
So can I have three different tables in data item and select at the same time three different fixed length ascii files and each one import a specific table?kirkostas™0
-
You have 3 dataitems in same file.
Each data item can have its own format, but you can mix lines in dataitems.
You can import data to a temporary table and modify/Insert data to correct tables.0 -
I think what he means is "Can I have a dataport that imports three separate files all at the same time."
The answer in that case is no. If you combine them into one file then you can easily import into multiple tables at once, but not as separate files.0 -
Basically it is one file format per dataport. You can create a dataport that imports/exports into/from multiple tables, but those records would have to be in one file.0
-
You can create it via codes.
Ex.CLEAR(dataportname); dataportname.IMPORT := TRUE; dataportname.Filename := toImportFilename1; dataportname.RUN; CLEAR(dataportname); dataportname.IMPORT := TRUE; dataportname.Filename := toImportFilename2; dataportname.RUN; CLEAR(dataportname); dataportname.IMPORT := TRUE; dataportname.Filename := toImportFilename3; dataportname.RUN;
Did not test it but if there is an error with commiting. You can add itNavision noob....0 -
Or you can set in the Field Designer only One variable with length. After this the variable get the actual line and then you can do anything with this.
...you declare 3 record type of variable for the tables and in the OnAfterImportRecord trigger you can use the data and drop between the tables. (COPYSTR...) :-s0 -
This is very clever Asallai but don't forget that I want to import three different files simultaneously. Or to have a flag, an option box, that it will skip the other tables. For example, I have three tables in my data item (customer, item, vendor) I have a custom request form with an option box and I choose to import my file into Vendor table. I do the following checks:
Vendor - OnPreDataItem() IF NOT (DataItem = DataItem::Vendor) THEN CurrDataport.SKIP; Vendor - OnBeforeImportRecord() IF NOT (DataItem = DataItem::Vendor) THEN CurrDataport.SKIP; Vendor - OnAfterImportRecord() IF DataItem = DataItem::Vendor THEN BEGIN // some custom code here... END;
But it always try to import my file to customer table and it crashes because length do not match. If I remove customer and item table it works. So how can I bypass the first two tables and import my file only to the third?
Conclusion is to have one dataport with many data items (many tables) and with a custom request form to import or export data only from the chosen table.kirkostas™0 -
-
kirkostas wrote:I want to import three different files simultaneously0
-
I think you're going to have to compromise on something to get this to work. One question I would have is how much time & energy do you want to spend to make the masterfile import process really elaborate. If it's only run once or twice by a few accounting people is it not better to spend developer/analyst resources on other tasks on the project/implementation?
As I see it there are 3 solutions:
1) combine all of your data into 1 big file with 2 line breaks between each dataset (this is the standard DataItemSeperator dataport property). This would allow you to run the import with a pretty straight forward dataport that has 3 data items.
2) build 3 different dataports that take a different file type. Then have a custom built form or process that gets the filenames from user or somewhere else and then calls the appropriate dataports.
3) just build 3 different dataports run them manually for each seperate file (not what you want - but it's quick to build and simple).
I'm sure there are other solutions out there that would work but how much time and energy is smart to spend on building these types of dataports - in my experience these are run once or a few times at Go Live and that's it.0 -
Very well put, and I agree 100%
Just for completeness' sake, solution 4: program a codeunit to read the data one line at a time, and decide per line what to do.0
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