Multiple variables for same (temporary) table

AK
Member Posts: 226
Hi,
I've 2 variables which point to the same table, and both have the property "temporary" set. So variable A should store one set of records, variable B another one. If the same record exists in the recordset of A, I can still insert it in B. If a record is modified by using variable A, this doesn't affect the same record stored with variable B. Am I right?
I've too much data to debug it properly in my actual task, but it seems as if action by using variable A are affecting record assigned to B. Is there a known bug in 2.xx?
Thanks!
I've 2 variables which point to the same table, and both have the property "temporary" set. So variable A should store one set of records, variable B another one. If the same record exists in the recordset of A, I can still insert it in B. If a record is modified by using variable A, this doesn't affect the same record stored with variable B. Am I right?
I've too much data to debug it properly in my actual task, but it seems as if action by using variable A are affecting record assigned to B. Is there a known bug in 2.xx?
Thanks!
0
Comments
-
Whenever I get to a question like this, I create a little test form to see what happens. In your case, you could create a form with a button and two temp table variables. I would probably use a master table, because they are easy to work with, so let's use the Item table. In OnPush you insert the same Item into each variable, but with different Description. If they would both point to the same internal temp table you should not be able to INSERT the same Item twice. Then program a message that displays the number and description of both of them and see what happens.0
-
DenSter wrote:Whenever I get to a question like this, I create a little test form to see what happens. In your case, you could create a form with a button and two temp table variables. I would probably use a master table, because they are easy to work with, so let's use the Item table. In OnPush you insert the same Item into each variable, but with different Description. If they would both point to the same internal temp table you should not be able to INSERT the same Item twice. Then program a message that displays the number and description of both of them and see what happens.
You mean something like "if you give a man a fish you feed hi for a day, if you teach him to fish you feed him for life."
I think What Daniel is saying is extremely important, yet being forgotten by too many developers today. Asking for guidance is one thing, but there are some things you have to do and try and learn from.David Singleton0 -
Thanks, but I already did this (should have mentioned it, sorry). It works like expected. But my code is a bit more complicated, using a recursive function in which the temporary tables are created and modified, which is hard to debug with the old debugger. I kind of hoped someone would say "known problem, this never really worked stable until version 3.xx" or something like that so I could look for a different solution for my task.
But if it should work I'd like to find my mistake.0 -
David Singleton wrote:You mean something like "if you give a man a fish you feed hi for a day, if you teach him to fish you feed him for life."No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
AK wrote:Thanks, but I already did this (should have mentioned it, sorry). It works like expected. But my code is a bit more complicated
What I can imagine is probably happening is that in this massive amount of code, there are two variables that have very similar names. Somewhere down the line some code that applied to one of them was copied to apply to the other, and Ctrl+H was used to do a find/replace. Now you're in debugging mode and you're not sure which variable is supposed to hold what value. I can predict with a fair amount of certainty that the variables are exactly what they are supposed to be according to the code. Good luck finding out where the error is.
Fun times with the debugger eh0 -
Luc Van Dyck wrote:David Singleton wrote:You mean something like "if you give a man a fish you feed hi for a day, if you teach him to fish you feed him for life."David Singleton0
-
David Singleton wrote:You mean something like "if you give a man a fish you feed hi for a day, if you teach him to fish you feed him for life."
I think What Daniel is saying is extremely important, yet being forgotten by too many developers today. Asking for guidance is one thing, but there are some things you have to do and try and learn from.
Well, actually I wasn't asking for fish nor did I expect someone to teach me fishing. I wanted to know if there are sharks in the water, because usually I fish in a different sea...0 -
AK wrote:I kind of hoped someone would say "known problem, this never really worked stable until version 3.xx"
Temptables had a few issues in the early versions, but by ver. 1.3 they were stable, and by 2.01 (I think that's when they allowed secondary keys) they worked great and without issues.David Singleton0 -
There is only one case, when you can use two "variables" on one temporary table. When you define the record variable as array. Each entity in the array will use same instance of temporary table (different "cursors" on same table). But if you are using two variables and both are temporary, they are isolated from each other.0
-
i hate that old debugger, even if some times it was funny to see it debugging itself...
sometimes, with small sized databases, i used this approach: backup the database, convert it to newer version, debug the code, restore the database on the old client... :twisted:
EDIT: ideally you should
1 backup
2 create a new db on a newer client
3 restore the database on the new database you have created at point 2 and debug0
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