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;
