*basic set CREATE CURSOR curBase (P_IX I,iMat I, nQty N(12,3)) TEXT TO lcTemp NOSHOW P_IX,iMat,nQty 1,1,2 2,1,3 3,1,4 4,2,0.2 5,2,20 6,2,8 7,2,22 ENDTEXT STRTOFILE(lcTemp,'Help.csv') APPEND FROM HELP.CSV TYPE CSV DELETE FILE HELP.CSVNow the user wants to deal with the sums of the material,
*summation set SELECT; iMat, SUM(nQty) AS nQty; FROM curBase; INTO curSum READWRITE; GROUP BY 1Now the user likes to handle the amount or less
*one altered REPLACE nQty WITH nQty-5[tricky part]
*result cursor CREATE CURSOR curTarget (P_IX I,iBase I,iMat I, nQty N(12,3)) *iBase points to curBase.P_IXI have the wear down the basic set biggest qty first (better would be best fitting)
*Result set TEXT TO lcTemp NOSHOW P_IX,iBase,iMat,nQty 1,3,1,4 2,7,2,22 3,5,2,21 4,6,2,8 5,4,1,0.2 ENDTEXTif I repeat the procsss for qty=4 on Material 1 again it would be
*summation set REPLACE nQty WITH 0 ALL LOCATE REPLACE nQty WITH 4 *input into result set curTarget neede here *Result set now (old and new data) TEXT TO lcTemp NOSHOW P_IX,iMat,nQty 1,3,1,4 2,7,2,22 3,5,2,21 4,6,2,8 5,4,1,0.2 6,2,1,3 7,1,1,1 ENDTEXTAny idea to do this via SQL INPUT?