problems with temporaray table while opening a form

shilpareddy
Member Posts: 28
Dear All,
I have a table with the fields:
Variable DataType
Access Type Option (Public,Private);
User Name Text
and some other fields.........
Now I wanted to open a form based on the following conditions:
1. I should able to see all users of public
2. current user private and public records.
For this, I have tried with the following code....
REPEAT
IF RecordVariable."User Name" = USERID THEN BEGIN
RecordVariable2 := RecordVariable;
RecordVariable2.INSERT;
END ELSE
IF RecordVariable.AccessType = RecordVariable.AccessType::Public THEN BEGIN
RecordVariable2 := RecordVariable;
RecordVariable2.INSERT;
END
UNTIL RecordVariable.NEXT=0;
Here, RecordVariable2 is the temporary Variable.
With this, I can able to see the form but I am unable to insert new records
in the form
Moreover, we tried with MARK function also. Still we are getting the same problem.
So, if any body find a soultion for the problem..please reply.
Thanks,
I have a table with the fields:
Variable DataType
Access Type Option (Public,Private);
User Name Text
and some other fields.........
Now I wanted to open a form based on the following conditions:
1. I should able to see all users of public
2. current user private and public records.
For this, I have tried with the following code....
REPEAT
IF RecordVariable."User Name" = USERID THEN BEGIN
RecordVariable2 := RecordVariable;
RecordVariable2.INSERT;
END ELSE
IF RecordVariable.AccessType = RecordVariable.AccessType::Public THEN BEGIN
RecordVariable2 := RecordVariable;
RecordVariable2.INSERT;
END
UNTIL RecordVariable.NEXT=0;
Here, RecordVariable2 is the temporary Variable.
With this, I can able to see the form but I am unable to insert new records
in the form
Moreover, we tried with MARK function also. Still we are getting the same problem.
So, if any body find a soultion for the problem..please reply.
Thanks,
With Regards,
Shilpa Reddy
Shilpa Reddy
0
Comments
-
I suppose you do a FORM.RUNMODAL(FORM::"Some Form", RecordVariable2);
When you insert/modify/delete a record, it happens on the temptable. So in the OnInsertRecord,OnModifyRecord,OnDeleteRecord, you have to write code to insert/modify/delete the record in the REAL table.
eg. in the OnInsertRecord-trigger:
recMyRealTable := rec
recMyRealTable.INSERT(TRUE); // this generates an error if the record already exists in the real table
EXIT(TRUE);Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi,
your problem is that if you use MARK function your new record is outside your filter and if you use temporary record it is not written to the database.
Two ways to solve your problem:
- use a form on a temporary record and fill the triggers
OnInsertRecord, OnModifyRecord, OnDeleteRecord with statements which do the datebase update.
- use one form to show the records in the described ways and use a new form to insert new record filtered with the field "User Name" = USERID.
br
Josef Metzbr
Josef Metz0
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