Skip to main content

Notifications

Business Central forum
Suggested answer

Fill table via Visual Studio

Posted on by 5

Hello dear forum,
I've been working on a project for the university for a long time. I have to fill a table via Visual Studio with the information of another already given table. Unfortunately, I don't know how to do that. I would be happy if you could help.

Kind regards
Danny

Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,639 Super User 2024 Season 2 on at
    RE: Fill table via Visual Studio

    Hi, If you mean to insert values, you can use Record.Insert() Method.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-insert--method

    pastedimage1670804676361v1.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,217 Moderator on at
    RE: Fill table via Visual Studio
    hi
    try this 
    local procedure InsertSyncTableLoop()
        var
            SourceTable: Record SourceTable;
            SyncTable: Record "Sync Table";
        begin
            if SourceTable.FindFirst() then
                repeat
                    SyncTable.Init();
                    SyncTable."Primary Key" := SourceTable."Primary Key";
                    SyncTable.D1 := SourceTable.S1;
                    SyncTable.D2 := SourceTable.S2;
                    SyncTable.D3 := SourceTable.S3;
                    SyncTable.Insert();
                until SourceTable.next = 0;
        end;
    check my answer if it helped you, thanks
    DAniele
  • Suggested answer
    pankaj.k Profile Picture
    pankaj.k 960 on at
    RE: Fill table via Visual Studio

    Hi Densonx21

    Please check the below link that will help you to insert data in new table.

    https://learn.microsoft.com/en-US/dynamics365/business-central/dev-itpro/administration/set-up-standard-company-configuration-packages

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-extension-install-code

    Have a great day!

    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has verified answer.

    Thanks,

    Contact Info: kuwalpankaj97@gmail.com  

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans