TransferFields to temp, modify and replace original!?
pettal
Member Posts: 20
Hi All,
This might be simple but my head is firmly wedged this morning! ](*,)
I basically have the Comment Line table and some of the data in it is duff and needs to be modified.
I think I need to:
Filter and duff records to a temp table
Modify duff records in temp table
Copy modified records back from temp table into Comment Line table
But for the life of me I can't get anything to work.
Pointers, examples...general life guidance appreciated! 8-[
This might be simple but my head is firmly wedged this morning! ](*,)
I basically have the Comment Line table and some of the data in it is duff and needs to be modified.
I think I need to:
Filter and duff records to a temp table
Modify duff records in temp table
Copy modified records back from temp table into Comment Line table
But for the life of me I can't get anything to work.
Pointers, examples...general life guidance appreciated! 8-[
0
Answers
-
Use a second (not Temporary) variable for comment line: "Temp Comment Line".
Then you will be able to:
- Filter records on your "Comment Line". Transferfields to "Temp Comment Line".
- Modify "Temp Comment Line".
- Use MODIFY function.
- Go to next record on "Comment Line".Tomas,
Dynamics NAV Enthusiast0 -
Thanks Tomas
This what I got so far.... and it doesn't work!??!
"Comment Line".SETFILTER("Comment Line"."Table Name",'97');
TempTable.TRANSFERFIELDS("Comment Line");
TempTable."Table Name" := TempTable."Table Name"::"Job";
TempTable.Modify;
It's sort of there...but is deffo missing something.... like maybe a brain cell!?
0 -
I am not sure, why you have such data (97 in Table Name field in Comment Line table), however if I remember correctly, you cannot use MODIFY function on fields which are used in active keys.
You could do something like this:"Comment Line".SETFILTER("Comment Line"."Table Name",'97'); IF "Comment Line".FIND('-') THEN REPEAT TempTable.TRANSFERFIELDS("Comment Line"); "Comment Line".DELETE(FALSE); TempTable."Table Name" := TempTable."Table Name"::Job; TempTable.INSERT(FALSE); UNTIL "Comment Line".NEXT = 0;Tomas,
Dynamics NAV Enthusiast0 -
Tomas you are a star!
0 -
-
Hmmm I'm pretty sure it wasn't me.... I think :roll:
Probably a coding "fudge" for something a long time ago and no one has noticed.... until now.
Thanks once again!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
- 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
