Need an example for edit method explanation with tables.

Can Anyone help me how to write edit method in Table and how it works in forms…

Thank you in advance.

For AX 2009…
I wrote find method in AXP_CarTable as:

public static AXP_CarTable find(Si_NO _sino,boolean _set)
{
AXP_CarTable axpc;
;
select axpc where axpc.Si_No==_sino;
return axpc;
}

and edit method in AXP_Rental table as :
edit Mileage editmileage(boolean _set, Mileage _mileage)

{

Mileage mileage=_mileage;
AXP_RentalTable axpr;
AXP_CarTable axpc;
;
if(_set)
{
if(_mileage)
{
ttsbegin;
axpc = AXP_CarTable::find(this.Si_No,true);
axpc.mileage= mileage;
axpc.update();
ttscommit;
}
}
else
{
mileage= AXP_CarTable::find(this.Si_No,false).mileage;
}
return mileage;
}

I created a new control of Int edit in form but wen i edit the value I’m getting an error as:
Cannot edit a record in AXP_CarTable (AXP_CarTable).
The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause.

You are not selecting the record for update.

axpc.selectForUpdate(_set);

if (Si_NO )
{
select firstonly axpc where axpc.Si_NO == Si_NO ;
}

return axpc;

Thanks Kranthi, I have done and its working correctly now.
I have one doubt when I edit the value in IntEdit, the value is not reflecting in form immediately.
I have to close and open the form again, is there any way to reflect it immediately.

You are entering the value, why it has to refresh? Are you not seeing the value that you have entered?

I can see the value I’m giving in tat control but y it can’t immediately update in tat form.

Not clear. If you can see, then what is the issue? May be an example or screen shot will help in understanding your issue.