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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...