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

Announcements

No record found.

News and Announcements icon
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 436

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

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    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.

  • Muhammad Anas Naeemi Profile Picture
    436 on at

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

  • Suggested answer
    Amit Profile Picture
    2,563 on at
    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
  • Verified answer
    DAnny3211 Profile Picture
    11,421 Super User 2026 Season 1 on at

    hello

    you can now use this very powerful function

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

    DAniele

  • Verified answer
    YUN ZHU Profile Picture
    100,212 Super User 2026 Season 1 on at

    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

  • Muhammad Anas Naeemi Profile Picture
    436 on at

    Issue resolved. Thanks to all.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,012 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 986 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 659 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans