NAV strange behaviour when doing a get()

txerifftxeriff Member Posts: 500
Hi Mates,

I hope you all right.

A colleague and I are a bit surprised with this:

I´ve got some strange behaviour (see attached screen)

For some reason get() for rec37extendida.get does not work unless you set the values into code and integer variables.

vCode:=Rec37."Document No.";
vLineNo:=Rec37."Line No.";



This has been tested in clean cronus database, NAV2009R2 build 32012.

any ideas,

thanks!
Edit:

if any1 wants to try, find the extended table here:
https://ufile.io/1mats

Piece of code:

BuscaCampoTablaExtendida(RecRef : RecordRef;Texto : Text[50];VAR Devuelve : Variant)

CASE RecRef.NUMBER OF
  36:BEGIN
       RecRef.SETTABLE(Rec36);
       IF rec36Extendida.GET(Rec36."Document Type", Rec36."No.") THEN BEGIN
         CASE Texto OF
           'TextoIdioma':Devuelve := rec36Extendida."Posting Description Language";
         END;
       END;
     END;
  37:BEGIN
       RecRef.SETTABLE(Rec37);
       //Rec37.SETRECFILTER;
       vCode:=Rec37."Document No.";
       vLineNo:=Rec37."Line No.";
       //try replacing vcode and vlinenno by Rec37."Document No." and Rec37."Line No." and it wont work
       IF rec37Extendida.GET(Rec37."Document Type", vCode,vLineNo) THEN BEGIN

        MESSAGE('ok');
         CASE Texto OF
           'TextoIdioma':Devuelve := rec37Extendida."Description Language";
         END;
       END;
     END;

END;

Answers

  • waitwait Member Posts: 53
    Maybe stupid question but in the line that is commented out you are using the document type invoice but in the other one you are using the document type of the sales line, could you be overseeing something there? Otherwise I've seen sometimes some hidden values in fields, for instance when pasting values into fields return characters come with them, maybe that could be the case?
  • txerifftxeriff Member Posts: 500
    wait wrote: »
    Maybe stupid question but in the line that is commented out you are using the document type invoice but in the other one you are using the document type of the sales line, could you be overseeing something there? Otherwise I've seen sometimes some hidden values in fields, for instance when pasting values into fields return characters come with them, maybe that could be the case?

    Hi,
    The line commented out was a trial of hardcoding some fields.
    If you look at the example in screen capture, I use "document type" from T37 in the first column of the get(). Extended table "document type" its been copied from source, I just compared optionstring for both tables.

  • lubostlubost Member Posts: 627
    Your rec37extendida has probably 4 fields in primary key, so GET should use all primary key fields.
  • txerifftxeriff Member Posts: 500
    edited 2018-11-23
    lubost wrote: »
    Your rec37extendida has probably 4 fields in primary key, so GET should use all primary key fields.
    Thanks for the suggestions.

    It´s an "extended table" with the same key fields. We compared this already here.


    If any1 would like to try, Find table attached:

    https://ufile.io/1mats

    Function to be called:
    
    BuscaCampoTablaExtendida(RecRef : RecordRef;Texto : Text[50];VAR Devuelve : Variant)
    
    CASE RecRef.NUMBER OF
      36:BEGIN
           RecRef.SETTABLE(Rec36);
           IF rec36Extendida.GET(Rec36."Document Type", Rec36."No.") THEN BEGIN
             CASE Texto OF
               'TextoIdioma':Devuelve := rec36Extendida."Posting Description Language";
             END;
           END;
         END;
      37:BEGIN
           RecRef.SETTABLE(Rec37);
           //Rec37.SETRECFILTER;
           vCode:=Rec37."Document No.";
           vLineNo:=Rec37."Line No.";
           //try replacing vcode and vlinenno by Rec37."Document No." and Rec37."Line No." and it wont work
           IF rec37Extendida.GET(Rec37."Document Type", vCode,vLineNo) THEN BEGIN
    
            MESSAGE('ok');
             CASE Texto OF
               'TextoIdioma':Devuelve := rec37Extendida."Description Language";
             END;
           END;
         END;
    
    END;
    
  • AKAK Member Posts: 226
    Table 37 has 3 key fields, Document Type,Document No.,Line No. If rec37Extendida is a copy of that, you have to use all 3 fields in the GET command. It's strange that it seems to work if you use just 2 variables, because it shouldn't work at all.
  • txerifftxeriff Member Posts: 500
    edited 2018-11-23
    AK wrote: »
    Table 37 has 3 key fields, Document Type,Document No.,Line No. If rec37Extendida is a copy of that, you have to use all 3 fields in the GET command. It's strange that it seems to work if you use just 2 variables, because it shouldn't work at all.

    Shit i sent wrong table, sorry about that. I was busy with other topics and...
    Its lines...
    you call from SL subform to:
    RecRef.GETTABLE(Rec);
    CU.BuscaCampoTablaExtendida(RecRef, 'TextoIdioma', TextoIdioma);

    I updated the link with t37.


  • txerifftxeriff Member Posts: 500
    Any1?
  • AKAK Member Posts: 226
    I already told you, your table has a primary key of 3 fields, you are only using 2 values in your get command.
  • txerifftxeriff Member Posts: 500
    edited 2018-11-26
    AK wrote: »
    I already told you, your table has a primary key of 3 fields, you are only using 2 values in your get command.

    In my get I use 3 of em:
    37:BEGIN
    RecRef.SETTABLE(Rec37);
    //Rec37.SETRECFILTER;
    vCode:=Rec37."Document No.";
    vLineNo:=Rec37."Line No.";

    //try replacing vcode and vlinenno by Rec37."Document No." and Rec37."Line No." and it wont work
    IF rec37Extendida.GET(Rec37."Document Type", vCode,vLineNo) THEN BEGIN

    How come this works and this does not?
    IF rec37Extendida.GET(Rec37."Document Type", Rec37."Document No.";,Rec37."Line No.";) THEN

  • AKAK Member Posts: 226
    edited 2018-11-26
    I'm sorry, I somehow overlooked several times that you are indeed using all 3 values. Shame on me!
  • txerifftxeriff Member Posts: 500
    AK wrote: »
    I'm sorry, I somehow overlooked several times that you are indeed using all 3 values. Shame on me!

    Just have a look in that nav2009R2 build 32012.
    if you can, of course.
    Its really strange.
Sign In or Register to comment.