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...
Answered

Extracting value from table to another

(0) ShareShare
ReportReport
Posted on by 386

I want to add some of the fields from Payment Journal table like "Posting Date", "Document Type", "Document No.", "Account Type", "Account No.", and "Description" (shown in fig1) in another customised table i.e. "G/L Table" (shown in fig 2). I have used a loop but the main issue that I am facing is that it is getting only the last record rather than all the records. I have also attached the code screenshot (fig 3). Kindly help me with this issue.    

pastedimage1668517740051v1.png

pastedimage1668518009181v2.png

pastedimage1668518159547v3.png

  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Extracting value from table to another

    Issue resolved. Thanks to all.

  • Verified answer
    YUN ZHU Profile Picture
    85,843 Super User 2025 Season 1 on at
    RE: Extracting value from table to another

    Hi, I vote for Amit's code.
    Another problem in your code is that you cannot use Get method, the Get method will only get one record, you should use Setrange or Setfilter.

    In your sample, you should fitler try first, then repeat.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-get-find-and-next-methods#get-method

    Hope this helps as well.

    Thanks.

    ZHU

  • Verified answer
    DAnny3211 Profile Picture
    9,280 Moderator on at
    RE: Extracting value from table to another

    hello

    you can now use this very powerful function

    learn.microsoft.com/.../devenv-data-transfer

    DAniele

  • Verified answer
    Amit_Sharma Profile Picture
    2,547 on at
    RE: Extracting value from table to another
    Hi,
    Below the code for your reqirement.
    GenJournalLine.Reset;
    GenJournalLine.Setfilter("Journal Template Name",'GENERAL');
    GenJournalLine.Setfilter("Journal Batch Name",DEFAULT');
    if GenJournalLine.Findset then begin
      Repeat
       check.init;
       check."Posting Date" := GenJournalLine."Posting Date";
       check."Document No." := GenJournalLine."Document No.";..... so on
       .......
       Check.Insert;
      Until GenJournalLine.Next =0;
    end; 
    Regards
    Amit Sharma
  • Muhammad Anas Naeemi Profile Picture
    386 on at
    RE: Extracting value from table to another

    Not working. Can you send me the code for this?

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: Extracting value from table to another

    You have to use with Gen. Journal Line variable with Repeat until with Template and Batch filter and then write your code inside that loop.

    Thanks.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans