Record.COPY with Temporary variable

Fisherman
Member Posts: 456
All
I have a function that is calling Codeunit 99000770 (Where-Used Management) in order to find out which assemblies a particular component is used in. I've added a new fuction to Where-Used Management to externalize the results to my function. That new function looks like this:
WhereUsedList is the existing global, temporary record variable pointing to Where-Used Line. In my calling function, I trap the result as
When I ran it through the debugger, count was returning 0 for a component I knew to be in multiple assemblies, so I went back to Where-Used Management and inserted
And found that there were, in fact, 1185 records in the WhereUsedList record variable.
Any ideas here? I feel like I'm missing something basic, but after looking through posts here and online, nothing's really ringing a bell. This is 5.0 SP1.
I have a function that is calling Codeunit 99000770 (Where-Used Management) in order to find out which assemblies a particular component is used in. I've added a new fuction to Where-Used Management to externalize the results to my function. That new function looks like this:
CopyWhereUsed(VAR WhereUsedListCopy : TEMPORARY Record "Where-Used Line") Count : Integer WhereUsedListCopy.COPY(WhereUsedList); EXIT(WhereUsedListCopy.COUNT());
WhereUsedList is the existing global, temporary record variable pointing to Where-Used Line. In my calling function, I trap the result as
AssyCount := WhereUsedMgt.CopyWhereUsed(tmpWhereUsed) IF (AssyCount > 0) THEN BEGIN...
When I ran it through the debugger, count was returning 0 for a component I knew to be in multiple assemblies, so I went back to Where-Used Management and inserted
MESSAGE('Where Used Count %1', WhereUsedList.COUNT());
And found that there were, in fact, 1185 records in the WhereUsedList record variable.
Any ideas here? I feel like I'm missing something basic, but after looking through posts here and online, nothing's really ringing a bell. This is 5.0 SP1.
0
Comments
-
Stupid me... forgot to loop the temporary records and insert.
Problem solved.0 -
Well, if you are using 2009R2 and both tables are temporary you could try using
WhereUsedListCopy.COPY(WhereUsedList,TRUE);
C/Side Help wrote:...
Record.COPY(FromRecord [, ShareTable])
ShareTable
Type: Boolean
Specifies whether the function creates a copy of the record or creates a reference to a temporary record.
If FromRecord and Record are both temporary and ShareTable is true, then the COPY function does not create a new copy of the record. Instead, the COPY function causes Record to reference the same table as FromRecord.
The default value is false. If you specify false, all records are copied to Record from FromRecord.0 -
I've been wondering about that. We're not in 2009 yet, but will be migrating soon.0
-
Hi,
this replaces the array of temporary record structure/workaround. Nice feature, this.
with best regards
Jens0
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