Friday, January 24, 2014

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

Search hierarchy for a match (TableALLGroup) X++

  Table1 ppt;  select firstonly ppt  order ItemCode, ItemRelation, AccountCode, AccountRelation where      (ppt.ItemCode == TableGroupAll::T...