Transferfields
mxc
Member Posts: 42
As we all know, transferfields copies fields based on the Field No. property of the fields. My problem is the following: I want to transfer the fields from table 38 (purchase header) to table 5109 (purchase header archive), but I have two fields where the numbers do not correspond and of course, I´m getting an error...
How can I solve this problem in a simple way?
Yesterday I tried to change the field nos. and to make a long story short, I had to restore a backup...
How can I solve this problem in a simple way?
Yesterday I tried to change the field nos. and to make a long story short, I had to restore a backup...
Regards,
Manuel Xavier
Manuel Xavier
0
Comments
-
I only see two ways
- Using dataports
- Using fieldref and FIELDEXIST
discover the fields, and store that in a vector.
copy all fields from table 38 to 5109
(simulating transferfields)
Nuno Maia0 -
Hi Manuel
I don't think there is an easy way to solve this
.
I think the simplest solution is to create a function within a codeunit or even on one of the two mentiond tables.
In this function you will individually assign each field from record from Table 38 to the corresponding field in table 5109. The function would only need one run time parameter Rec Table38 and a local Variable of rec for Table 5109.
This way you can call the function from anywhere
. Answer the question and wait for the answer.0 -
I compared the Field No. of all the fields in both tables and found one field 5043, that in one table is an integer and in the other is boolean. Why does TRANSFERFIELDS works with this and doesn't work with my fields??Regards,
Manuel Xavier0 -
FROM Online Help
The fields must have the same data type for the copying to succeed (text and code are convertible, other types are not.0 -
I just read on the navision attain C/AL Programming manual that: the integer value is not interchangeable with the constant of TRUE or FALSE.Regards,
Manuel Xavier0 -
Hi
From OnLine Help 'Integers'In addition to representing whole numbers in this range, you can use integers to represent boolean values. For boolean values, -1 represents TRUE and 0 represents FALSE.
This is why the Integer / Boolean transfer worksAnswer the question and wait for the answer.0 -
Hi mxc,
Transferfields will transfer fields from one table to other if the field no and the datatype matches.Firstly to sort ur problem out u can say
PurchaseHeaderArchive.transferfields(PurchaseHeader);
PurchaseHeaderArchive.newfield1 := PurchaseHeader.newfield1;
PurchaseHeaderArchive.newfield2 := PurchaseHeader.newfield2;
where newfields doesnot match the number.
Secondly,ur question was y field no 5043 (boolean in table 38 and integer in table no 5109) is not giving a problem though they r different datatypes?
Reason is you can assign a boolean or option values to integer.
similarly a text can take code.
hope this helps.LR0 -
export all objects as text, import all objects as text (all objects are now NOT compiled), rename field, compile all objects, smile!"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0
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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 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