Options

NoSeriesManagement.INITSERIES

CGaraldeCGaralde Member Posts: 19
edited 2015-04-06 in NAV Three Tier
Hi,

I just have a question regarding an error that I am encountering regarding the INITSERIES function in the NoSeriesManagement codeunit.

I am getting the error:
"Type conversion is not possible because 1 of the operators contains an invalid type. Code := Text"

My code is:
NoSeriesMgt.InitSeries('OB-SO','OB-SO',0D,"SO Link",'OB-SO');

My scenario is:
From my limited knowledge in NAV, I know that the first, second and last parameters all refer to the NoSeries.Code. So I was just trying to hardcode the default, old and new series code to 'OB-SO' instead of creating a field which basically points to the same thing. Now when I try to compile, I get the "type conversion" error on the last parameter.

Any help is appreciated. :D

Answers

  • Options
    neilgfneilgf Member Posts: 148
    Hi!

    Looks like "SO link" causing the issue. This should be a code type field so what is it?

    On a sales header table the same call is:
    NoSeriesMgt.InitSeries(GetNoSeriesCode,xRec."No. Series","Posting Date","No.","No. Series");

    If it is not this field, please send your number series table and confirm which version of Nav you are using.

    Neil
  • Options
    CGaraldeCGaralde Member Posts: 19
    HI Neil,

    Thanks for taking the time. First of all, I am using Nav 2013 R2.

    Anyway, "SO Link" is defined as CODE[15] on Rec. I know that the error is on the last parameter because when I change it to, let's say Rec."No. Series" then no error appears.

    I do use the same parameters as the Sales Order, in my earlier projects but my gripe with my current scenario is, the first, second and last parameters are all CODE[10] then why is it only showing an error on the last parameter.

    Thanks.
  • Options
    neilgfneilgf Member Posts: 148
    Hi,

    Not sure I can help then. It does look odd so may be worth checking latest list of bugs for Nav 2013R2.

    The last but one parameter should be a code 20 -at least it should in the GB version - as this is the document number which is always as far as I am aware code 20. But then if you pass code 15 it will cope.

    Only other think is where is "SO Link" coming from? Which table?

    Neil
  • Options
    CGaraldeCGaralde Member Posts: 19
    Hi,

    "SO Link" is in my customized Order Book table. It basically meant to hold the SO (Sales Order Confirmation) Document number and therefore link the Order Book with the Confirmation, hence "SO Link". :D

    Again, my main problem is why the error of Type Conversion Code:=Text when:

    -Isn't Code directly convertible to Text?
    -'OB-SO' as a parameter value is not accepted, when 'OB-SO' as a value, in Rec table, in No. Series field is accepted?
    InitSeries(DefaultNoSeriesCode : Code[10];OldNoSeriesCode : Code[10];NewDate : Date;VAR NewNo : Code[20];VAR NewNoSeriesCode : Code[10])
    

    -DefaultNoSeriesCode, OldNoSeriesCode accepts 'OB-SO' while NewNoSeriesCode does not?

    I am stumped. ](*,)
  • Options
    vaprogvaprog Member Posts: 1,125
    Hi

    that error message might be misleading. Actually, that last parameter is a VAR parameter. You cannot supply a text constant.
  • Options
    CGaraldeCGaralde Member Posts: 19
    Aha!

    Thanks vaprog! I am a a bit of a newbie at this and you are right, it is a VAR parameter. Actually, I did not know about VAR parameters until you pointed it out. So a VAR parameter only accepts references and not values. You learn something new everyday.

    Thanks again everyone for the help.
Sign In or Register to comment.