filter is not working

rakeshranjanrakeshranjan Member Posts: 18
HI all
I am using 3.7 , I write a function in which i update a counter , But this code is updating only one recode , not all. can any one help me to out of this problem.it is working in 5.0 .the code is ...


mRecTransSalesEntry.SETCURRENTKEY("Sales Order No.","Sales Order Line");
mRecTransSalesEntry.SETFILTER("Sales Order Line",'<>0');
IF mRecTransSalesEntry.FIND('+') THEN
mReplCount:=mRecTransSalesEntry."Sales Order Line"
ELSE
mReplCount:=0;

TransSalesEntry.RESET;
TransSalesEntry.SETRANGE("Sales Order Line",0);
TransSalesEntry.SETRANGE(Date,090111D,TODAY);
MESSAGE('%1',TransSalesEntry.COUNT); --- Count return 1 but total record is 3000
IF TransSalesEntry.FIND('-') THEN
REPEAT
mReplCount += 1 ;
TransSalesEntry."Sales Order Line" := mReplCount;
TransSalesEntry.MODIFY;
UNTIL TransSalesEntry.NEXT = 0;
COMMIT;

Answers

  • thmartinthmartin Member Posts: 90
    You change the value of a field you are filtering on. After that modification your current record is outside the filter and subsequently NEXT returns 0.
    Thomas Martin
    NAV Developer
  • krikikriki Member, Moderator Posts: 9,112
    Check http://www.mibuso.com/howtoinfo.asp?FileID=22 (see section "EXAMPLES for modifying records.") on how to change records while reading them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.