Copy a field content to a nother field on same table
Mic28
Member Posts: 13
Hello everybody; I've created a decimal field in a table and simply I want to copy the content of another decimal field from the same table. I've try newfield:=oldfiel; but doesn't works. I suppose it's easy but I'm starting with C/AL and I don't know too much.
Thanks.
Thanks.
0
Comments
-
Copy from the same table ? This means also from the same record ?
In any case, if you are doing this operation thrue a report, don't forget the MODIFY instruction.
For instance:
Table1.Field2 := Table1.Field1;
Table1.MODIFY;My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
Thanks; yes, in the same table the same, copy the contenct of that field. This code that you've posted; I have to put in OnValidate from fileld1 from table or where, please?.
Thank you for help.0 -
No, the modify is only necessary for Report and Dataport.
In the Table, in the field containing the data to be copied ("Field 1" in our example), your code must be in OnValidate :
"Field 2" := "Field 1";
Be carefull to the key:if "Field 2" is in the primary key you'll have to rename the recordMy candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
Thanks for reply, but it doesn't work; this is how I've commented that I had done in my first post; I've put field2:=field1; in OnValidate from field1 (also on field2) but it shows 0. Any idea please?.
Thanks.0 -
Why it could not work:
1. Because you are on a form, so your value is not updated
2. Because the field is not editable
3. Because the destination field is in primary key
4.....
So:
Your code must be in the table and not in the form
If you modification is made in the form (when your code is really in the table) you must update your form to see the change.
Check if Field 2 is editable (in the table)
Check if it's not a flow field
Check if it's not a part of the primary keyMy candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
Thanks for reply; all it's ok, I'm doing it in table, except that field1 it's a flowfield; any problem with this?.
Thanks.0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 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