How to copy value on Dataport Import
selece28
Member Posts: 316
Hi All,
I have a question about Dataport,
How to copy value from one fields to another before import using Dataport
Ex: I have two fields, A and B
First both of the Fields is Empty
On Import using Dataport, i only insert into field A, but before insert, i want to copy the value from field A into field B (i want to use field B to keep previous value of field A)
I use code : A:= B; on before Import but the value is incorrect
How to solve this problem
Thanks in advance
I have a question about Dataport,
How to copy value from one fields to another before import using Dataport
Ex: I have two fields, A and B
First both of the Fields is Empty
On Import using Dataport, i only insert into field A, but before insert, i want to copy the value from field A into field B (i want to use field B to keep previous value of field A)
I use code : A:= B; on before Import but the value is incorrect
How to solve this problem
Thanks in advance
______________
Regards,
Steven
Regards,
Steven
0
Answers
-
The right place is OnAfterImportRecord0
-
No if i put it OnAfterImportRecord, then field B value will be the same as the field A value______________
Regards,
Steven0 -
... and what are your dataport fields?0
-
I have 3 fields to import from csv
lets say fields X,Y,A
when i import i want to copy field A value to field B, the insert the csv value into X,Y,A
i also insert a Date type field to keep the update date(workdate)______________
Regards,
Steven0 -
As I wote before, the right place to fill fields not filled by dataport fields is OnAfterImportRecord trigger. If your field is allready filled, there must be some code to do it (for example in OnValidate trigger in table).0
-
re-read your post. You want to transfer A value to B but you say they both fields are originally blankEx: I have two fields, A and B
First both of the Fields is Empty
On Import using Dataport, i only insert into field A, but before insert, i want to copy the value from field A into field B (i want to use field B to keep previous value of field A)
so B should be blank
are you saying that on the second line import you want A to retain it's value from the import of the first line?
now if you can add more detail to your post it would be easier to help you.0 -
Ok here's the example (X is the primary key)
First my table is like this
example:
Column X Y A B D(type = Date)
Value(Blank all)
Then i Import csv to fill falue X,Y,A
example:
Column X, Y, A, B, D(type = Date)
Value 1, 1, 1, (blank because copy from A), 27/02/07(workdate)
Then if i import the next csv to update/insert data
example:
Column X, Y, A, B, D(type = Date)
Value 1, 1, 2, 1(copy from previous value), 27/02/07
Value 2, 3, 3, (blank), 27/02/07
Value 3, 4, 4, (blank), 27/02/07
and so on
So when import, first i copy value A to B, then insert new imported value to A______________
Regards,
Steven0 -
It seems that you are importing the file with the same primary key. So, can you send me your object and your csv files, I will try to find the problem.0
-
It seems to me that you should do the following
Set a global variable MyRecVar type record the same as the dataitem
you are importing
in the AfterImportRecord section
B := '';
IF MyRecVar.GET(X) THEN
B := MyRecVar.A;
Hope this helps0 -
yes, all i want to do is copy the A value to B value before insert a new value into A______________
Regards,
Steven0 -
Could anyone helps ](*,)______________
Regards,
Steven0 -
In OnBeforeImportRecord trigger (first line):
SaveA := A;
In OnAfterImportRecord trigger:B := SaveA;
SaveA is a global variable with same type as A and B.0 -
Thanks but i think my problem solved
Thank you to Lubost =D> [/code]______________
Regards,
Steven0 -
Thanks but i think my problem solved
Thank you to Lubost =D>
Upps sorry double post #-o______________
Regards,
Steven0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions