CollectItemEntryRelation(VAR TargetItemEntryRelation : TEMPORARY Record "Item Entry Relation") OK : Boolean TempItemEntryRelation.RESET; TargetItemEntryRelation.RESET; IF NOT TempItemEntryRelation.FIND('-') THEN EXIT(FALSE) ELSE REPEAT TargetItemEntryRelation := TempItemEntryRelation; TargetItemEntryRelation.INSERT; UNTIL TempItemEntryRelation.NEXT = 0; TempItemEntryRelation.DELETEALL; EXIT(TRUE);
Comments
The RESET removes the filters and selects the primary key on the temptable, BUT DOES NOT TOUCH the records itself that are in the temptable.
So REPEAT-UNTIL will read all records that are in the temptable passed to the function by the calling program.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
cheers,
So doing a RESET removes the filters, BUT IT DOESN'T TOUCH the records in the temptable.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I understand the RESET doesn't affect the values within the record variable, just the filters and keys. However, I'm a bit confused about what's happening within the function. Sorry for being obtuse.
There are 2 record variables involved in this function. This one is passed TargetItemEntryRelation to the function from another Codeunit. The function's first line is to RESET a differenet TEMP record TempItemEntryRelation.RESET;
which to me means there should be no records in TempItemEntryRelation because the called function is not part of a single instance codeunit, and TempItemEntryRelation is not part of a function call. Am I right? Then there's the FIND line on the (in my mind anyway) TEMP var, which should be false, but because of the NOT, is always true.
Maybe because it's Monday, but it's all clear as mud to me. Any insight greatly appreciated.
cheers,
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks for your time, both of you.
cheers,
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!