Can't insert record in temporary RecordRef :(

arcull
Member Posts: 191
Hi, I would like to insert some records from real table to temporary table using RecordRef, but unfortunately it doesn't work, It says the record already exists in table already the first time it enters the loop. The real table 13010988 is not empty, but since I want to store records in temporary instance of it, that shouldn't matter. Does anyone know what could be the problem, thanks.
FERecR2.OPEN(13010988,TRUE); //FERecR2.SETTABLE(FERecTmp); REPEAT MESSAGE(FORMAT(FERecR2.COUNT)); FERecR2 := FERecR; FERecR2.INSERT; UNTIL FERecR.NEXT = 0; MESSAGE('%1',FERecTmp.COUNT);
0
Comments
-
For a temporary table you make a variable of DataType Record AND set the property Temporary to Yes. But if you make a variable of DataType RecordRef there is no property Temporary. I guess what you want to do isn't possible.
The error you get is because your RecordRef is pointing to the actual table.0 -
You need to use the DUPLICATE-function of recordref.
A recordreference is like a pointer to some data and you just assign the pointer to another variable BUT THEY BOTH POINT TO THE SAME DATA!Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks, I thought of that already, but why is there the option to open RecordRef as Temp when associating it with a table FERecR2.OPEN(13010988,TRUE); ? Because if you use the TRUE switch and try to count the records in RecordRef you get 0, while without it you get the actual number of records in physical table. So I thought it may be used this way.
FERecR2.OPEN(13010988,TRUE); FERecR2.SETTABLE(FERecTmp);
In order to get records inserted in Record variable. Where FERecTmp is the same table but marked as temporary. But now I guess it can't be done this way. Thanks anyway.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