Hi
I had a strange problem today, with some previously working code, that wasn't made by me.
Without changing anything, some code just stopped working after i compiled the codeunit container it.
I have simplified the code, just to give you an idea, of what i was up against.
GlobalLotNo is a global variable, LotNo is a parameter in the function AssignLot, and the record Parameter "Order", contains a field called LotNo.
Previously, the GlobalLotNo would be assigned the value of LotNo (in this case '0001'). But now NAV uses the Order.LotNo instead, which in this case is blank.
The debugger doesn't know this, because it keeps displaying '0001' in LotNo (it thinks it is the parameter, and not the field.) (Yes, the debugger is not that clever, I know
)
I can see why this is bad code, and you should not have a parameter called exactly the same as a field within a WITH DO clause.
But did the interpretation of this code change in some version of the NAV client ?
Please don't mind the code as much, because it is very simplified, I know this does absolutely nothing meaningful
OnRun()
AssignLot(OrderPending,'0001');
AssignLot(Order : Record "Order Request Pending";LotNo : Code[20])
WITH Order DO BEGIN
GlobalLotNo := LotNo;
END;
Best Regards
Thomas Korsgaard
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.