Hi all.
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
Comments
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;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
But I also see a problem with the following code
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.
http://navisionfreak.blogspot.com/
Justas Janauskas
my problem is when the user selects a few records in Form3 and hits OK, the following code
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 code
works fine.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n