any body can help in below case using code unit
created the function recordvalidation() where
VCMS_EXP_TRA and VCMS_EXP_TRA1 referring the same table
Enty no. is primary key
/////////////////////////////////////////////////
LOCAL recordvalidation()
VCMS_EXP_TRA.RESET;
IF VCMS_EXP_TRA.FINDFIRST THEN
REPEAT
VCMS_EXP_TRA1.SETRANGE(EntryNo,VCMS_EXP_TRA.EntryNo);
IF VCMS_EXP_TRA1.FINDFIRST THEN
BEGIN
VCMS_EXP_TRA1.GenJour:= TRUE;
VCMS_EXP_TRA1.MODIFY;
END;
UNTIL VCMS_EXP_TRA.NEXT=0;
///////////////////////////////////////////
while nobody accessing this table.
getting below erro.
Microsoft Dynamics NAV
---------------------------
Another user has modified the record for this CMS_EXP_TRA after you retrieved it from the database.
Enter your changes again in the updated window, or start the interrupted activity again.
Identification fields and values:
EntryNo='200'
---------------------------
OK
---------------------------
*This post is locked for comments
Try this one for update record
Documentation()
OnRun()
ExcelBufer.RESET;
ExcelBufer.DELETEALL;
GenSetup.GET;
//xlApp.Workbooks.OpenText(FileName,1257,1,1,1,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,'|');
ExcelBufer.OpenBook('setsystempath.xlsx','customer');
ExcelBufer.ReadSheet;
ExcelBufer.RESET;
IF ExcelBufer.FINDSET THEN BEGIN
REPEAT
SrNo := 0;
IF OldRowNo <> ExcelBufer."Row No." THEN BEGIN
ExcelBufer2.RESET;
ExcelBufer2.SETRANGE("Row No.",ExcelBufer."Row No.");
IF ExcelBufer2.FINDSET THEN BEGIN
REPEAT
SrNo += 1;
IF SrNo = 1 THEN BEGIN
Cust.RESET;
Cust.SETRANGE("No.",ExcelBufer2."Cell Value as Text");
IF Cust.FINDFIRST THEN BEGIN
Cust.INIT;
Cust."No." := ExcelBufer2."Cell Value as Text";
END;
END;
IF SrNo = 2 THEN BEGIN
IF ExcelBufer2."Cell Value as Text" <> '' THEN BEGIN
Cust.Name := ExcelBufer2."Cell Value as Text";
Cust.MODIFY;
END;
END;
IF Cust."Gen. Bus. Posting Group" ='' THEN BEGIN
Cust."Gen. Bus. Posting Group" :='NACIONAL';
Cust.MODIFY;
END;
IF Cust."VAT Bus. Posting Group" ='' THEN BEGIN
Cust."VAT Bus. Posting Group" :='NAC CLIENT';
Cust.MODIFY;
END;
IF Cust."Customer Posting Group" ='' THEN BEGIN
Cust."Customer Posting Group" :='01NACIONAL';
Cust.MODIFY;
END;
IF Cust."Payment Method Code" ='' THEN BEGIN
Cust."Payment Method Code" :='04';
Cust.MODIFY;
END;
IF Cust."Payment Terms Code" ='' THEN BEGIN
Cust."Payment Terms Code" :='30D';
Cust.MODIFY;
END;
UNTIL ExcelBufer2.NEXT = 0;
END;
OldRowNo := ExcelBufer."Row No.";
END;
UNTIL ExcelBufer.NEXT = 0;
END;
ExcelBufer.RESET;
ExcelBufer.DELETEALL;
thanks .
it is functioning perfectly.
Try only this VCMS_EXP_TRA.MODIFYALL(GenJour,TRUE);
thanks
updated the same . it executed without updating the field value.
VCMS_EXP_TRA.RESET;
IF VCMS_EXP_TRA.FINDFIRST THEN BEGIN
VCMS_EXP_TRA.MODIFYALL(GenJour,TRUE);
END;
Ok Thanks.
now it executing successfully without any error
but it is not updating the record GenJour.
VCMS_EXP_TRA.RESET;
IF VCMS_EXP_TRA.FINDFIRST THEN BEGIN
VCMS_EXP_TRA.MODIFYALL(GenJour,TRUE);
END;
The REPEAT loop is unuseful. MODIFYALL works on all record (accordingly to filters) massively.
hi,
You dont need the Repeat statement.
// The result of this statement:
CustomerRec.MODIFYALL("Statistics Group", 2);
// is equivalent to:
IF CustomerRec.FIND('-') THEN
REPEAT
CustomerRec."Statistics Group" := 2;
CustomerRec.MODIFY;
UNTIL CustomerRec.NEXT = 0;
I have modified the same code but it is showing the same error
VCMS_EXP_TRA.RESET;
IF VCMS_EXP_TRA.FINDFIRST THEN
REPEAT
VCMS_EXP_TRA.MODIFYALL(GenJour,TRUE);
UNTIL VCMS_EXP_TRA.NEXT=0;
Not so clear what you're trying to do. You're looping through VCMS_EXP_TRA record for modifying themself.
If you want to modify the GenJour field of all the VCMS_EXP_TRA records you can do directly this:
VCMS_EXP_TRA.MODIFYALL(GenJour,TRUE);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156