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

Community site session details

Session Id :
Business Central forum
Under review by Community Managers

Under review

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

how to iterate all the record of table on the action button in card page

Posted on by 194
how to iterate all the record of table on the action button in card page and transfer the data into another table in business central?
 
I want to transfer all the employees through apply pf action button and get the data into pf table here without the duplication of rows.
 
here the code but its not correct:
 action(/Apply PF/)
            {
                Promoted = true;
                PromotedCategory = Process;
                ApplicationArea = All;
                trigger OnAction()
 
                var
                    DescTbl: Record KSP_PROFUNDLIST_TBL;
                    sourcetbl: Record KSPsalarydetails_tbl;
                    // sal_list: Page KSPpayslip_pg_salary;
 
                    autoinc: Integer;
 
                begin
 
                    DescTbl.Reset();
                    sourcetbl.Reset();
                    Clear(DescTbl);
                    sourcetbl.SetRange(/CNIC NO./, rec./CNIC_NO./);
                    rec.SetFilter(/CNIC_NO./, DescTbl.CNIC);
                    // CurrPage.SetSelectionFilter(sourcetbl);
                    // sourcetbl.Next();
                    if sourcetbl.Findset then begin
                        repeat
                            DescTbl.Init();
                            Clear(DescTbl);
                            // autoinc += 1;
                            // DescTbl.Autoincrement := autoinc;
                            // DescTbl.Autoincrement := rec./Line No./;
                            DescTbl.Autoincrement := DescTbl.Autoincrement;
                            DescTbl.CNIC := sourcetbl./CNIC NO./;
                            desctbl.salary_date := sourcetbl.salary_date;
                            desctbl.Providentfund_Empshare := sourcetbl.Providentfund_Empshare;
                            desctbl./Organization Share/ := sourcetbl.Providentfund_Empshare;
                            DescTbl./ Total PF / := DescTbl.Providentfund_Empshare + DescTbl./Organization Share/;
 
                            DescTbl.Insert(true);
                        until sourcetbl.Next = 0;
                        // Message('Data Has Been Transferred Successfully !!');
                    end;
                end;

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans