DataPort

subrata.bauri
Member Posts: 21
I have a txt file which contains item no and Description .
I want to insert these values into a table (TableA) which contaions Item No1 and Descriptions1.
For this I have created a DATAPORT for TableA.
I want to do this in this away first dataport match the item no with the Item No1. and THEN insert the Descrition into the Description1 ELSE insert nothing?
How it will be controlled?
I want to insert these values into a table (TableA) which contaions Item No1 and Descriptions1.
For this I have created a DATAPORT for TableA.
I want to do this in this away first dataport match the item no with the Item No1. and THEN insert the Descrition into the Description1 ELSE insert nothing?
How it will be controlled?
0
Comments
-
There are properties for that. I don't remember the exact name, it's something like AutoUpdate or AutoInsert (just press F1 on each similar looking property). If it's set correct, then it will update those records where the primary key is the same as you imported.
If that field is not a primary key in this table, then you have to do it by code (SETCURRENTKEY - SETRANGE - FIND('-') the record, VALIDATE the field, MODIFY the record and so on). Probably in the OnAfterImport trigger.0 -
I am not 100% sure, but I think the onafterImport() trigger (of the data item) might be too late to do that.
When I have to do validation by code in a dataport (e.g. cropping field entries which are too long) I'm using the onBeforeEvaluateField trigger.
It is passed the parameter Text by reference, where you can modify the field before the data is inserted.
This is where I would implement the logic to check the import, the same way you suggested it.
But, as I said, it is just a suggestion that works for me.
cheers, m.... I am not a programmer, I just write code.0 -
It's OK when directly importing to fields. For updating data, which is not connected by primary keys, one can import into global variables, and then write the code to update the data in the tables in the OnAfterImport trigger.0
-
ah, I see.
well, of course this was something I didn't understand in the question then - but looking at it again now, I think you re right.
thanks for clarifying it.... I am not a programmer, I just write code.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