Parameter hided by global

FommoFommo Member Posts: 138
Hi there

I found a pretty odd thing i NAV 5.0. I guess it must be a bug.
In Codeunit 396 - NoSeriesManagement there is a global variable NoSeriesCode that should contain the number series code (great name, huh?).
Well, the problem is that in function TryGetNextNo the first parameter is named exactly the same, NoSeriesCode. #-o
Normally this conflict should be solved by choosing the local parameter since it has a smaller scope, but after hours of debugging I've found out that the function uses the global uninitialized NoSeriesCode resulting in error since you can't get numbers from an empty number series code. ](*,)

Have anyone more than me got this problem. The easiest solution for me is to rename the function parameter for the functions that use this name, or what? :roll:

Comments

  • kinekine Member Posts: 12,562
    1) In older versions of NAV is same code with same variable names and I had never problems with it.
    2) I tried easy test and all is working correctly. The local variable is used.
    3) It seems that problem is elsewhere. Check if No. Serie field is filled correctly in the record (e.g. posting No. Serie field in sales order etc.)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • FommoFommo Member Posts: 138
    kine wrote:
    1) In older versions of NAV is same code with same variable names and I had never problems with it.
    2) I tried easy test and all is working correctly. The local variable is used.
    3) It seems that problem is elsewhere. Check if No. Serie field is filled correctly in the record (e.g. posting No. Serie field in sales order etc.)

    I don't know. Renaming the parameter solved the problem anyway. It worked perfectly as soon as I've done that. :?
Sign In or Register to comment.