SourceTableTemporary forms with DELETEALL

Mauddib
Member Posts: 269
I just had a weird experience and am wondering is it normal or something odd I did.
I was playing with the form for Tariff numbers. I made it a tree by turning it into a temp table form with the SourceTableTemporary property. To populate the table I first do a DELETEALL and then populate it.
This works fine when I run the form.
This does NOT work fine if I click the LOOKUP button on the item card to the new form.
Basically, it seems to ignore the "SourceTableTemporary" property when you use the form as lookup.
This of course means my ACTUAL table got the DELETEALL treatment.
I was playing with the form for Tariff numbers. I made it a tree by turning it into a temp table form with the SourceTableTemporary property. To populate the table I first do a DELETEALL and then populate it.
This works fine when I run the form.
This does NOT work fine if I click the LOOKUP button on the item card to the new form.
Basically, it seems to ignore the "SourceTableTemporary" property when you use the form as lookup.
This of course means my ACTUAL table got the DELETEALL treatment.
0
Comments
-
If the DELETEALL is in OnOpenForm, then you don't need it. When the form opens with a temp record, that temp reconrd doesn't have any values yet. comment out that statement and see what happens.
By the way, why would you use a form that's set to use temp records as a lookup form?0 -
As I said I took the Tarriff form and made it an expandable tree form. I needed to make it a temporary form to do this.
The deleteall is not the problem. The fact the forum is opened NOT as a temporary form is. If I remove the Deleteall then when i try and populate the table i will get a "Record already exists" type message because I am not populating an empty table but a real one.
Just means I need to recode the lookup by declaring the form as a variable and running it that way.
Still I found it interesting.0 -
Then the form is not based on a temporary record, or what is displayed is a variable other than what the form is based on. When you create a temporary variable, it is empty. You don't have to delete anything from a temporary table that is empty.
Personally I would create a separate form, but that's me.0 -
The form IS based on temporary. SourceTableTemporary IS yet to yes and when I RUN the form it acts as expected.
I am referring however to when the form is run from the table, for example if the form is listed in the field "LookupFormID" of a given table.
When run in this fashion Navision ignores the field SourceTableTemporary and runs the form based on the normal live table.
I thought it an interesting fact to highlight on the forum.
As a case example of the DELETEALL. I know that you do not need a DELETEALL on opening the form. It depends how you code it however. Take for a good example form 583 in Nav5 standard. This is based on a temp table. There is a function for InitTempTable() which is called both on opening the form and while using the form. For this reason the code has DELETEALL in this function. This means DELETEALL gets run on opening the form when it is not technically needed.
I copied this idea in my own form and when running the form via a lookup the contents of the REAL table were deleted, not the temp table.0 -
Mauddib wrote:When run in this fashion Navision ignores the field SourceTableTemporary and runs the form based on the normal live table.
Irritating when forms behave like that, I agree, and thanks for sharing that. I still think creating two separate forms is the way to go personally.0 -
DenSter wrote:So I was right, and the form does NOT run with a temporary record
We seem to have been talking at cross purposes somehow. This is what I was saying from the start. The form is set to run off a temp record but in this one situation it doesnt do it. I guess its a bug but who knows.0 -
Mauddib wrote:We seem to have been talking at cross purposes somehow. This is what I was saying from the start.
I was trying to make light of that.
0 -
Mauddib wrote:DenSter wrote:So I was right, and the form does NOT run with a temporary record
We seem to have been talking at cross purposes somehow. This is what I was saying from the start. The form is set to run off a temp record but in this one situation it doesnt do it. I guess its a bug but who knows.
It is not a Bug. It is how it works. If the property is set, and you run the form, the Rec is temporary. But if you are running the form through code, and you pass the record to it, the Rec is using the record variable you passed in, and if this variable is not temp, the form will not work with it as temp. And this is the case of lookup form... it means that passing variable to the form "overrides" the setting of Rec variable of the form. It is like the "Temporary" property on function parameter when the parameter is called by ref (var=Yes). In this case the table will be real table or temporary table based on the passed variable, regardless the parameter property...0 -
Kine wrote:It is like the "Temporary" property on function parameter when the parameter is called by ref (var=Yes). In this case the table will be real table or temporary table based on the passed variable, regardless the parameter property...
Now, i put some lines of code in the function to checkc if the table variable is temporary0
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