Announcements
Hi All,
I am trying to update the table AssetBook. and getting the following error message:
Cannot edit a record in Fixed asset book (AssetBook). The record has never been selected.
Here is a snippet of my code:
assest = strRTrim(strLTrim(conPeek(record,1))); //Column 1
Info(assest);
acquisitionDt = conPeek(record,2); //Column 2
depricationProfile = conPeek(record,3); //Column 3
isDepricate = conPeek(record,4); //Column 4
costCentre = conPeek(record,5); //Column 5
assetBookTbl.clear();
ttsbegin;
select forupdate assetBookTbl where assetBookTbl.AssetId == assest;
if(assetBookTbl)
{
assetBookTbl.AcquisitionDate = str2Date(acquisitionDt,123);
assetBookTbl.DepreciationProfile = depricationProfile;
if(isDepricate == "Yes")
assetBookTbl.Depreciation = NoYes::Yes;
else
assetBookTbl.Depreciation = NoYes::No;
assetBookTbl.update();
}
ttscommit;
I am reading data from a .csv file and updating the table. I used infolog to check and data is being read correctly.
Plz help me understand my mistake in code.
Thank you.
The issue got resolved.
There was issue with converting str to date.
I replaced assetBookTbl.AcquisitionDate = str2Date(acquisitionDt,123);
with assetBookTbl.AcquisitionDate = any2Date(acquisitionDt);
This worked for me.
Hi Gunjan,
Thank you for the response. There has been no customization on the table or its methods. I will use a debugger on the update method and check.
Thank you.
Hi Nsb,
I don't see anything wrong in the code you have given here. Is there any existing customization to AssetBook\update method that might be causing the issue? Have you debugged update method to check which line of code is causing the issue?
André Arnaud de Cal...
294,017
Super User 2025 Season 1
Martin Dráb
232,852
Most Valuable Professional
nmaenpaa
101,158
Moderator