Need a Dataport for navision

flo
Member Posts: 25
Hi all
I have a Problem in creating a Dataport.
My Problem is that I want to Create a Dataport that only inserts Data to the Table that is not yet in it.
That means I have a csv-file with data that is already in the table and data that has to be imported into it.
I do not want to "update" the data that is already in the table.
I tried it as followed:
Dataport properties:
AutoSave: Yes
AutoReplace: No
AutoUpdate: No
C/AL
OnAfterImportRecord:
But when I start a RUN of The Dataport I get an Errormessage that tells me that my "Table."Nr." already exists.
I do not know where the fault is in the report ... settings that are not mentioned are all default.
I hope to get an answer soon
Thanks in advance
greetingZ
flo
I have a Problem in creating a Dataport.
My Problem is that I want to Create a Dataport that only inserts Data to the Table that is not yet in it.
That means I have a csv-file with data that is already in the table and data that has to be imported into it.
I do not want to "update" the data that is already in the table.
I tried it as followed:
Dataport properties:
AutoSave: Yes
AutoReplace: No
AutoUpdate: No
C/AL
OnAfterImportRecord:
IF <Global Var>.GET (Table."Nr.") THEN CurrDataport.SKIP ELSE IF <Global Var>.GET (Table.Name) THEN CurrDataport.SKIP ELSE BEGIN <Global Var>."Nr." := <Global Var>."Nr."; .... .... <Global Var>.INSERT; END;
But when I start a RUN of The Dataport I get an Errormessage that tells me that my "Table."Nr." already exists.
I do not know where the fault is in the report ... settings that are not mentioned are all default.
I hope to get an answer soon
Thanks in advance
greetingZ
flo
0
Comments
-
Hi,
The clean way of doing this would be create a new Dataport data item with type Integer and one line below the Integer dataitem set the Autosave,Autoupdate and Autoreplace to NO. Then declare all the global variables in Global and put the same fields in the Dataport fields, then go to the code and in the code instead of using a GET use the SETRANGE syntax and if found CurrDataport.skip else INIT and INSERT.
Thanks
Best regards
Suresh.0 -
thnx 4 the reply, but i ve got it already.
it was the insert-command in the end of my code. i replaced it with update and now it works.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