assigning record variables

Eugene
Member Posts: 309
what exactly an assignment of a record variable to record variable means
for example in "Bank Account Ledger Entry"OnAfterGetRecord trigger i find the following code:
BankAccLedgEntry2 := "Bank Account Ledger Entry";
WITH BankAccLedgEntry2 DO BEGIN
...
END;
is BankAccLedgEntry2 another table-cursor to the same undelying table with fields, filters assigned from original one or does it become another reference to the same table-cursor ?
C/SIDE courseware explains the situation with codeunit variables but is very vague on this issue with Record variables.
Thank you for your help
for example in "Bank Account Ledger Entry"OnAfterGetRecord trigger i find the following code:
BankAccLedgEntry2 := "Bank Account Ledger Entry";
WITH BankAccLedgEntry2 DO BEGIN
...
END;
is BankAccLedgEntry2 another table-cursor to the same undelying table with fields, filters assigned from original one or does it become another reference to the same table-cursor ?
C/SIDE courseware explains the situation with codeunit variables but is very vague on this issue with Record variables.
Thank you for your help
0
Comments
-
BankAccLedgEntry2 := "Bank Account Ledger Entry";
will not copy the filters ( just the field values), you need to use the COPY function for this, or a separate COPYFILTERS after the assignment.
You can step through BankAccLedgEntry2 independently, performing any action needed, while leaving the cursor on "Bank Account Ledger Entry" untouched, so it should be a different table-cursor.Kai Kowalewski0 -
I always viewed it the same way as using transferfields only for the same table
BankAccLedgEntry2.transferfields("Bank Account Ledger Entry");
It doesn't copy filters, when you do assignment. It basically creates another recordset pointing to the same record. It is a different version so if you modify with BankAccLedgEntry2.
and then modify "Bank Account Ledger Entry", you'll get another user modifeid error.
To copy all the filters use
BankAccLedgEntry2.copy("Bank Account Ledger Entry");
Copy will have the filters. but still is a different version.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