Using temporary records

jorgito
Member Posts: 115
Hi all.
I have a form called Form1 that has a button that opens a new form Form2 using a temporary record:
Inside Form2, I have a button that opens another form Form3.
I have a Set function in Form3 that copies the original Record2 to a global variable Record3 inside Form3.
When the user selects a few lines in Form3, I want to enter some lines in Record2. So, I have the following code to fill in Record3 which is mapped to Record2 in Form2
However, the above code does not work.
How can I use a temporary record of one form in another form??
Any ideas?
Jorgito
I have a form called Form1 that has a button that opens a new form Form2 using a temporary record:
Form2.SETTABLEVIEW(Record2); Form2.LOOKUPMODE(TRUE); Form2.RUNMODAL;where Record2 is a temporary record.
Inside Form2, I have a button that opens another form Form3.
Form3.Set(Rec); Form3.LOOKUPMODE(TRUE); Form3.RUNMODAL;
I have a Set function in Form3 that copies the original Record2 to a global variable Record3 inside Form3.
Set(VAR TempRec : TEMPORARY Record "Record") Record3 := TempRec;
When the user selects a few lines in Form3, I want to enter some lines in Record2. So, I have the following code to fill in Record3 which is mapped to Record2 in Form2
LocalRec.COPY(Rec); CurrForm.SETSELECTIONFILTER(LocalRec); IF LocalRec.FIND('-') THEN REPEAT Record3.INIT; .... UNTIL LocalRec.NEXT = 0;
However, the above code does not work.
How can I use a temporary record of one form in another form??
Any ideas?
Jorgito
0
Comments
-
I can tell you that the set function will not work
You need to loop through it and insert it into record3.
Set(VAR TempRec : TEMPORARY Record "Record")
if TempRec.find('-') then repeat
Record3 := TempRec;
Record3.insert;
until TempRec.next = 0;0 -
ara3n is right, that record assignment does not assign a reference of another records.. it just copies the values of one record fields to another.
But I also see a problem with the following codeForm2.SETTABLEVIEW(Record2); Form2.LOOKUPMODE(TRUE); Form2.RUNMODAL;
where Record2 is temporary record.
In this code the form will open just with FILTERS of Record2, but not with ENTRIES from Record2. If you want to open form with temporary record entries, you must use this code (as far as I remember):
form.runmodal(<form ID>, <record>)
where <record> is temporary record.0 -
Actually,
my problem is when the user selects a few records in Form3 and hits OK, the following codeLocalRec.COPY(Rec); CurrForm.SETSELECTIONFILTER(LocalRec); IF LocalRec.FIND('-') THEN REPEAT Record3.INIT; .... Record3.INSERT; UNTIL LocalRec.NEXT = 0;
does not insert the records into Record3 (Record2 in Form2). So when Form3 closes and the user returns to Form2, the records are not there.
I tried changing the tables to Non-temporary and everything works fine. However, they must be temporary, so that whenever many users work on the same table, each gets his own working space.
And, by the way, the codeForm2.SETTABLEVIEW(Record2); Form2.LOOKUPMODE(TRUE); Form2.RUNMODAL;
works fine.0 -
Did you change the set function the way I suggested?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
- 321 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