doubt with insert

uri84uri84 Member Posts: 30

i have a doubt with insert...

i do a report that gets a text file and insert the tex into the table 81 and it works fine.
but when i get another txt and do the same, it rewrittes the lines before and don't do nothing.
it seems an error of the setrange or something... anyone can help? i'm so newbbie in this yet..
the code:

81.INIT ;
81.SETFILTER(81.DocNumber,DocNumber)) ;
81."Document No." := DocNumber;


this is a part of the code it's only to try to understand how i have to do this..
I want to create one line every txt file that i import.



  • Options
    vaprogvaprog Member Posts: 1,125

    I don't quite understand, what exactly the fragment of code you gave us is supposed to do and what you do or don't do before.

    Please check, what are the primary key values at the time you insert the record.

    The counter in your dialog, does is count to more then one plus the initial value? In other words: do your INSERTs succeed? Do you have a reason to ignore failed inserts? If not I recommend to alter that code IF 81.INSERT... to
    TotProcesados += 1;
    IF the insert fails, you get an error, otherwise the insert is counted
    I don't see any reason to set that filter. What do you intend to achieve with it? A filter only causes an effect when you query the database using FIND, FINDSET, FINDFIRST, FINDLAST, NEXT, or when an object does a query implicitly in a Dataitem or the Rec variable on a Form.
  • Options
    uri84uri84 Member Posts: 30
    i found what is the problem...
    i'm executing this report on Nav2013 en when i debug and focus the mouse in var "81" it shows a popup with de key that is using but... i put a setcurrentkey and it doesn't change so...

    anyone knows... how can i change the key that shows the debugger when you focus the mouse over the vars.?

    key.jpg 12.8K
  • Options
    SogSog Member Posts: 1,023
    Wait wait, you want to use the setcurrentkey function (which is basically an "Order By" clause) to modify the key values?
    Maybe you should start with an introduction in C/Side before you continue.

    If that is not what you mean, but you want to see another key instead of the primary key values, I don't think that is supported in the current debugger.
    |Pressing F1 is so much faster than opening your browser|
  • Options
    Cem_KaraerCem_Karaer Member Posts: 281
    You must use FINDSET after SETRANGE and before INSERT.

    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
Sign In or Register to comment.