I have a dbf as _Del and its like this.
And I have some a cursor as ABC. Now I want to update records in my _Del using ABC. And also I want to update the records which are not in ABC. For the first update I used this and it's already working.
And for the second update I need to add this.
For this I need this kind of structure.
So how can I do this?
Thank You
Code:
SELECT nStylecode, Style,cLotName,cColorName,Delvr_Pcs FROM _DelClr INTO Dbf C:\Tempfiles\_Del
And I have some a cursor as ABC. Now I want to update records in my _Del using ABC. And also I want to update the records which are not in ABC. For the first update I used this and it's already working.
Code:
UPDATE _Del SET Delvr_Pcs=ABC.Delvr_Pcs FROM ABC ;
WHERE _Del.Style=ABC.Style AND _Del.nStylecode=ABC.nStylecode AND _Del.cLotName=ABC.cLotName
And for the second update I need to add this.
Code:
IF Colr_Desp.Tot_Desp>0
REPLACE _Del.Delvr_Pcs WITH ROUND(_DelQty.DelQty/Lot_Desp.Tot_Desp*Colr_Desp.Tot_Desp,0)
ELSE
IF Lot_CI.Tot_CI=0
REPLACE _Del.Delvr_Pcs WITH 0
ELSE
REPLACE _Del.Delvr_Pcs WITH ROUND(_DelQty.DelQty/Lot_CI.Tot_CI*_DelDtl.nCiQty,0)
ENDIF
ENDIF
For this I need this kind of structure.
Code:
IF && want to see the _Del records are in ABC [if there are in ABC need to do below update]
UPDATE _Del SET Delvr_Pcs=ABC.Delvr_Pcs FROM ABC ;
WHERE _Del.Style=ABC.Style AND _Del.nStylecode=ABC.nStylecode AND _Del.cLotName=ABC.cLotName
ELSE
IF Colr_Desp.Tot_Desp>0
REPLACE _Del.Delvr_Pcs WITH ROUND(_DelQty.DelQty/Lot_Desp.Tot_Desp*Colr_Desp.Tot_Desp,0)
ELSE
IF Lot_CI.Tot_CI=0
REPLACE _Del.Delvr_Pcs WITH 0
ELSE
REPLACE _Del.Delvr_Pcs WITH ROUND(_DelQty.DelQty/Lot_CI.Tot_CI*_DelDtl.nCiQty,0)
ENDIF
ENDIF
ENDIF
So how can I do this?
Thank You