Tejashree S
Tejashree S

Reputation: 311

Delete_from and delete

I have a customised table which has a prodid reference in it which refers the prodtable.

I need to delete the Prod table record from this customsied table record . but when i access the Prod table and try to delete it,the control just comes out without performing the operation

i have tried using

    delete_from ProdTable where prodTable.prodid == 'abc';

also

    select prodtable where prodTable.prodid =='abc';
    prodTable.delete();

Can anyone tell me why this is happening

Regards, TJ

Upvotes: 0

Views: 18821

Answers (3)

ian_scho
ian_scho

Reputation: 6056

the control just comes out without performing the operation

Do you need to refresh the form after calling the delete method?

Upvotes: 0

user85421
user85421

Reputation: 29700

First of all I would check if the select is returning the desired record:

    select prodtable where prodtable .prodid =='abc';
    info(strFmt('ProdId: %1, RecId: %2', prodtable.ProdId, prodtable .RecId));

Note: you need a select for update and be in a transaction to be able to delete (should generate an error if not in a transaction or not using forupdate)

    ttsbegin;
    select forupdate prodtable where prodtable .prodid =='abc';
    info(strFmt('ProdId: %1, RecId: %2', prodtable.ProdId, prodtable .RecId));
    prodtable.delete();
    ttscommit;

(assuming that prodtable is the customized table)

Upvotes: 4

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

I assume you did not use 'abc' but joined using a field from your customized table.

Maybe the ProdId in the customized table is left adjusted but the field in ProdTable is right adjusted?

Also have you checked if prodTable.doDelete is called in class method ProdTableType.delete?

Upvotes: 0

Related Questions