LastDailyReturn := 0; TempFundPriceNew.RESET; TempFundPriceNew.SETCURRENTKEY("Fund No.",Date); TempFundPriceNew.SETRANGE(TempFundPriceNew."Fund No.","Temp Fund Price New"."Fund No."); TempFundPriceNew.SETRANGE(TempFundPriceNew.Date,StartDate,"Temp Fund Price New".Date); IF TempFundPriceNew.FINDFIRST THEN REPEAT LastDailyReturn += "Temp Fund Price New"."Bid Price LCY"; UNTIL TempFundPriceNew.NEXT = 0;
Answers
DailyReturn:=0;
TempFundPriceNew.RESET;
//maybe some item range -> TempFundPriceNew.SETRANGE("Item No", SelectedItem);
TempFundPriceNew.SETRANGE(TempFundPriceNew.Date, StartDate, EndDate);
IF TempFundPriceNew.FINDSET THEN BEGIN
REPEAT
DailyReturn += "Temp Fund Price New"."Bid Price LCY";
//would be better to create a function
SetNewPrice.RESET;
SetNewPrice.SETRANGE("Item No", SelectedItem);
SetNewPrice.SETRANGE(SetNewPrice.Date,"Temp Fund Price New".Date);
IF (SetNewPrice.FINDFIRST) THEN BEGIN
SetNewPrice.DailyReturn:=DailyReturn;
SetNewPrice.MODIFY();
END;
UNTIL TempFundPriceNew.NEXT = 0;
END;
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
When you modify record just use FINDSET(true,false)