22 May 2014

update table

update table

To update a field value in Table and ill sum the value in one field to update in another table.

Code in table level by Update method( where u want to change record  and update status)

public void update()
{
     QualityInspectionLine   _QualityInspectionLine;
     QualityInspectionTable  _QualityInspectionTable;

     super();

     select sum(percent) from _QualityInspectionLine where _QualityInspectionLine.ProjectID == this.ProjectID
                                                    && _QualityInspectionLine.InspectionStatus == InspectionStatus::Completed;

     select forUpdate _QualityInspectionTable where _QualityInspectionTable.ProjectID == this.ProjectID;

     ttsBegin;

     _QualityInspectionTable.TotalProgress = _QualityInspectionLine.percent;
     _QualityInspectionTable.doUpdate();

     ttsCommit;

}

No comments:

Post a Comment