Hi to all, I'm writing a ProcessOnlyReport, in OnAfterGetRecord I want to update a value adding a trailing A character to a record in a field that is the primary key.
If I use the MODIFY statement I got an error because I cannot modify the primary key of the record.
Looking at forum it seems that I have to delete the exisiting record and insert a new one (????). Is it correct ? Can someone suggest me the best practice to do this kind of operation?
My Table is called SalesDocument and has a primary key field called Document No.
I've tried the following code
SalesDocument.GET("Document No.");
SalesDocument.RENAME("Document No." + 'A');
but it fails to retrieve the document.
Can someone help me?
Thank you in advance for your help.
Best regards
Fabrizio
0
Answers
If your dataitem (of which you use onaftergetrecord) also loops the SalesDocument table it wont work though.
I'd also try saving the new key beforehand instead of adding to the old one
saveKey := "document no." + 'A';
RENAME(saveKey)
Yes what Waisa Said is true.
Just to add to that -
> Modify works when you change anything in the Record Except Primary Key.
> For Changing Fields which are part of Primary key use Rename.
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page