web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Transfer Data from a Temporary Table to a Normal Table

(0) ShareShare
ReportReport
Posted on by 380

Hello,

I have a table that calcs data into a temp table when it opens, however, I need to print some of this data based on if the user checks a box. I could not get a report to reference this data, so we agreed we needed a archive table anyway. So now I want to be able to archive the temp records into a normal table, then I can call a report for that. 

In short - how do I transferfields from a temp table to a non temp table?

Thanks,

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    You can just look through the temporary record set and use TRANSFERFIELDS or assign to create records. For ex:

    IF TempCustomer.FINDSET THEN

        REPEAT

         Customer.TRANSFERFIELDS(TempCustomer);

         Customer."No." := '';

         Customer.INSERT(TRUE);

        TempCustomer.NEXT  = 0;

    Regarding the report, you base a report based on the temporary table, you can use the Integer DataITem for it.

  • ChazKimRP Profile Picture
    380 on at

    Yea its not working I get this error. but im also pretty sure if i call the variable FP_FinanceWorksheetLine record it will be empty since thats a temp table.

    pastedimage1589378264414v1.png

        procedure ArchiveFinanceOptions();
        var
        FP_FinanceWorksheetLine: Record FP_FinanceWorksheetLine;
        FP_FinanceOptionsArchive: Record FP_FinanceOptionsArchive;
        FP_FinanceOptionsArchiveList: Page FP_FinanceOptionsArchive;
        NextEntryNo: Integer;
        begin
            NextEntryNo:=FP_FinanceOptionsArchive.GetRangeMax("Entry No.");

            FP_FinanceWorksheetLine.SetRange("Archive Line",true);
            
            if FP_FinanceWorksheetLine.FindSet then repeat
            FP_FinanceOptionsArchive.TransferFields(FP_FinanceWorksheetLine);
            FP_FinanceOptionsArchive."Entry No.":=NextEntryNo+1;
            FP_FinanceOptionsArchive.Insert;
            
            until FP_FinanceWorksheetLine.Next=0;
        end;
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    You cannot use GetRangeMax that way, you use that function when you specify the filter. Use find last to get the last entry no.

  • ChazKimRP Profile Picture
    380 on at

    seems like it still is not working. It is not entering any data into the archive table.

    FP_WorksheetLine is the temp table that has the data in it I want to archive. The procedure to archive is on the Worksheet page. In the below snip i get no worksheet lines are found.

        procedure ArchiveFinanceOptions();
        var
        FP_FinanceWorksheetLine: Record FP_FinanceWorksheetLine;
        FP_FinanceOptionsArchive: Record FP_FinanceOptionsArchive;
        FP_FinanceOptionsArchiveList: Page FP_FinanceOptionsArchive;
        NextEntryNo: Integer;
        begin
            if FP_FinanceOptionsArchive.FindLast then
            NextEntryNo:=FP_FinanceOptionsArchive."Entry No.";

            FP_FinanceOptionsArchive.Reset;

            FP_FinanceWorksheetLine.SetRange(Modified,false);
            FP_FinanceWorksheetLine.SetFilter("Entry No.",'<>0');
            
            if FP_FinanceWorksheetLine.FindSet then repeat
            Error('found a worksheet line');
            FP_FinanceOptionsArchive.TransferFields(FP_FinanceWorksheetLine);
            FP_FinanceOptionsArchive."Entry No.":=NextEntryNo+1;
            FP_FinanceOptionsArchive.Insert;
            
            until FP_FinanceWorksheetLine.Next=0;
            Error('No Worksheet Lines Found');
        end;
    pastedimage1589559456885v1.png
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    FP_FinanceWorksheetLine this variable doesn't seem like a temporary, if the worksheet page table is the source, then use that. You are creating a new variable which is not the temporary

  • ChazKimRP Profile Picture
    380 on at

    The worksheet line is the temp table and the page was set to sourcetabletemp=true.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Then you need to use Rec variable 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans