Programming conditions in import dataport

Archy
Member Posts: 70
Hi all!
I have an Excel document with fields I have to import to Navision table. Actually in Excel document there are item numbers, item translation and language code. I have to import this document to table Item Translation.
But there is one problem I cannot deal with - some items has already their translations and I should not overwrite them! Furthemore, if an item has translation and the language code in Excel is the same as in item's translation in Navision - I should skipe dataport, but if Excel's translation for this item has different language code - i have to add it.
So, it seems, I have to programm some conditions in the dataport's OnBeforeImportRecord trigger. But how can I use current dataport's field for comparison with database table's field? :-s May be any other ideas? Please, help!!!
I have an Excel document with fields I have to import to Navision table. Actually in Excel document there are item numbers, item translation and language code. I have to import this document to table Item Translation.
But there is one problem I cannot deal with - some items has already their translations and I should not overwrite them! Furthemore, if an item has translation and the language code in Excel is the same as in item's translation in Navision - I should skipe dataport, but if Excel's translation for this item has different language code - i have to add it.
So, it seems, I have to programm some conditions in the dataport's OnBeforeImportRecord trigger. But how can I use current dataport's field for comparison with database table's field? :-s May be any other ideas? Please, help!!!
0
Comments
-
Simple use a variable and
OnBeforeImportRecord()
INIT;
OnAfterImportRecord()
IF ItemTranslation.GET("Item No.","Language Code")THEN
CURRDATAPORT.SKIP;Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
David Cox wrote:Simple use a variable and
OnBeforeImportRecord()
INIT;
OnAfterImportRecord()
IF ItemTranslation.GET("Item No.","Language Code")THEN
CURRDATAPORT.SKIP;IF ItemTranslation.GET("Item No.","Language Code")THEN
should be:IF ItemTranslation.GET("Item No.",'',"Language Code")THEN
The primary key is "Item No.","Variant Code","Language Code".Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
& don't forget about the
AutoSave
AutoUpdate
AutoReplace
Properties0 -
kriki wrote:David Cox wrote:Simple use a variable and
OnBeforeImportRecord()
INIT;
OnAfterImportRecord()
IF ItemTranslation.GET("Item No.","Language Code")THEN
CURRDATAPORT.SKIP;IF ItemTranslation.GET("Item No.","Language Code")THEN
should be:IF ItemTranslation.GET("Item No.",'',"Language Code")THEN
The primary key is "Item No.","Variant Code","Language Code".
Oh Right I didn't check the primary key, and it's not a table I have used much, on the develoment side !
Thanks 8)Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
David Cox wrote:Simple use a variable and
OnBeforeImportRecord()
INIT;
OnAfterImportRecord()
IF ItemTranslation.GET("Item No.","Language Code")THEN
CURRDATAPORT.SKIP;
I'm sorry, I don't understand. :oops: What variable? What type should be this variable? How can I get for comparison value of current record Language Code in Excel?0 -
Archy wrote:David Cox wrote:Simple use a variable and
OnBeforeImportRecord()
INIT;
OnAfterImportRecord()
IF ItemTranslation.GET("Item No.","Language Code")THEN
CURRDATAPORT.SKIP;
I'm sorry, I don't understand. :oops: What variable? What type should be this variable? How can I get for comparison value of current record Language Code in Excel?
The fields "Item No.","Language Code" are filled in by the dataport. These you use to do a GET on "ItemTranslation". If the GET returns a TRUE, it means the record exists, and you can skip it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Oh, I understood, what variable - of type Item Translation. :oops: ok... Then we assume, that imported from Excel language code values are in field "Item Translation"."Language Code"? (I have one data item in this dataport - it is Item Translation)
But this fields allways are empty!I was looking in debugger..
0 -
Archy wrote:Oh, I understood, what variable - of type Item Translation. :oops: ok... Then we assume, that imported from Excel language code values are in field "Item Translation"."Language Code"? (I have one data item in this dataport - it is Item Translation)
But this fields allways are empty!I was looking in debugger..
BTW: did you fill in the fields in the dataport-fields (View=>Dataportfields)?Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Oops.. :oops: There my mistake was.. Thanks for help! It seems, soon I will get these records.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