Hi,
I have created a Wizard page, in Dynamics NAV 2017.
The Wizard has a few steps, and one of them shows a SubPage where the Source Table is Temporary.
The user will fill in multiple Lines in this SubPage, and at the end of the Wizard we do some validation checks, then insert these records into the real table.
I am struggling with how to retrieve these Temp records stored in the subpage.
Is there a way to do this?
I have tried the following, and it only returns the last record the user enters, the previous records are not found.
On the Temp SubPage, I have added a function called "GetTempRecords(VAR "TempTable")" (I am replacing the real table names here for the example).
This function essentially does the following:
IF Rec.FINDSET THEN
REPEAT
TempTable := Rec;
TempTable.INSERT;
UNTIL Rec.NEXT = 0;
I am then calling this from the Wizard Page, with the following line of code...
CurrPage.TempSubPage.PAGE.GetTempRecords(TempTable);
I used the VAR parameter, in the hope it would return all the records the user has entered.
When I debug, the line "Rec.FINDSET" only finds the last record entered, and I have tried adding "RESET" before but this didn't help.
Is there a better way to do this?
Answers
the function "GetTempRecords(VAR "TempTable") needed to use COPY(Rec, TRUE);