Dataport to update table fields

asembereng
Member Posts: 220
I created a dataport to update table fields but its not updating but instead writes a new record and increment the previous primary key by 1. Can someone help me? both AutoSave and Autoupdate is set to Yes. I dont know what i am doing wrong. Thanks
0
Comments
-
I think its updating now. I just set the transaction to UPDATE. need to test it further. Anyway better way of doing it?0
-
Are you sure your dataport contains also the primary key fields?
You need these to get the record and then to update it.
In general I would import the data into the fields of a table I DON'T save.
In the OnAfterImportRecord-trigger, I put some C/AL code to get the record, change the fields and to modify it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I am getting the primary key. Can you give me an example using the employee table if using the c/al option?0
-
The dataItem is "Employee".
-Properties
AutoSave,AutoUpdate,AutoReplace=no
In the "OnBeforeImportRecord()"-trigger, you must clear all the variables in your dataitemfields. If it are only fields of the dataitem-record, a CLEAR of it is enough:CLEAR(Employee);
In the OnAfterImportRecord()-trigger: (you need to define a new global "recEmployee" as type Record:EmployeerecEmployee.GET("No."); recEmployee.VALIDATE("Field 1","Field 1"); recEmployee."Field 2" := "Field 2"; recEmployee.VALIDATE("Field 3","Field 3"); recEmployee."Field 4" := "Field 4"; recEmployee.MODIFY(TRUE);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!1 -
Using comma to separate my fields, will recognize the first value before the comma as field 1 and next as field 2?
Thanks0 -
asembereng wrote:Using comma to separate my fields, will recognize the first value before the comma as field 1 and next as field 2?
Thanks
In the Dataport-properties you must put (you need also to put the < and the > ; the characters must be EXACTLY is I wrote):
FieldSeparator=<TAB>
FieldStartDelimiter,FieldEndDelimiter=<None>Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
thank you. I will give it a try right away.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