CLEAR(TBEntrySummTemp); vTBEntrySummTemp.COPY(TBEntrySummTemp,TRUE); //check if the table is temporary before deleting all the records RRCheckEmpty.GETTABLE(TBEntrySummTemp); IF NOT RRCheckEmpty.ISTEMPORARY THEN ERROR('Warning!TBEntrySummTemp variable must be Temporary!!!'); TBEntrySummTemp.RESET; TBEntrySummTemp.DELETEALL; IF TBItem.GET("Item No.") THEN BEGIN TBItemLedgEntry.SETCURRENTKEY("Item No.","Serial No.","Lot No.",Open,"Variant Code", Positive,"Location Code","Posting Date","Expiration Date"); TBItemLedgEntry.SETRANGE("Item No.","Item No."); TBItemLedgEntry.SETFILTER("Lot No.",'<>%1',''); TBItemLedgEntry.SETRANGE("Serial No.",''); TBItemLedgEntry.SETFILTER("Location Code", TBRentContrLines.FNTCreateLocationFilter(UserSetupMgt.GetSalesFilter,TBItem."Item Category Code")); TBItemLedgEntry.FINDSET; REPEAT TBItemLedgEntry.SETRANGE("Lot No.",TBItemLedgEntry."Lot No."); TBItemLedgEntry.CALCSUMS("Remaining Quantity"); IF TBItemLedgEntry."Remaining Quantity" > 0 THEN BEGIN TBEntrySummTemp."Entry No." += 1; TBEntrySummTemp."Lot No." := TBItemLedgEntry."Lot No."; MESSAGE(TBEntrySummTemp."Lot No."); RESET; SETRANGE("Lot No.",TBEntrySummTemp."Lot No."); IF FINDFIRST THEN TBEntrySummTemp."Selected Quantity" := Quantity; TBEntrySummTemp."Total Available Quantity" := TBItemLedgEntry."Remaining Quantity"; TBEntrySummTemp.INSERT; MESSAGE(TBEntrySummTemp."Lot No."); END; TBItemLedgEntry.FINDLAST; TBItemLedgEntry.SETFILTER("Lot No.",'<>%1',''); UNTIL TBItemLedgEntry.NEXT = 0; END;thanks in advance
Comments
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Second: I think that the FINDFIRST cleans the global variables. So better use another variable instead of rec.FINDFIRST. Or make your all your global variables local.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Second: i was going down this line of development, but only because of a "sixth sense"
anyway, can you explain me why does it happen? (i remember a post of mattrax -maybe- who said that the modify of the record clears the variables within it, but i don't know if it's related...)
thanks!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Remember that CLEAR (and I think also GET or FIND* or NEXT) does NOT clear the records in a global temptable in your record.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
that said, it was not the MODIFY instruction, as i remembered, but between the 2 triggers...just to make it clear, and to link that topic, that can be more helpful if linked to this one :thumbsup:
http://www.mibuso.com/forum/viewtopic.php?f=23&t=41868
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog