Get Records from SubPage based on a Temporary Table

JustJosh
Member Posts: 4
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:
I am then calling this from the Wizard Page, with the following line of code...
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?
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?
0
Best Answers
-
Managed to solve this, just in case anyone else is wondering...
the function "GetTempRecords(VAR "TempTable") needed to use COPY(Rec, TRUE);IF FINDSET THEN REPEAT TempTable.COPY(Rec, TRUE); TempTable.INSERT; UNTIL NEXT = 0;
0 -
Just in case anyone else needs to know it wasn't the code that was the problem.. It was because i was using a page as the subform. As soon as i changed this to ListPart it worked fine!0
Answers
-
Managed to solve this, just in case anyone else is wondering...
the function "GetTempRecords(VAR "TempTable") needed to use COPY(Rec, TRUE);IF FINDSET THEN REPEAT TempTable.COPY(Rec, TRUE); TempTable.INSERT; UNTIL NEXT = 0;
0 -
Just in case anyone else needs to know it wasn't the code that was the problem.. It was because i was using a page as the subform. As soon as i changed this to ListPart it worked fine!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
- 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