Options

extract data before commit

ara3nara3n Member Posts: 9,255
Hello
I'm looking for ideas on how extract the glentries that get posted to fix inconsistency issue. Normaly I use
message(GLEntry."G/L Account No." + ' ' + GLEntry."Amount");

I've tried to dump the data to file, but navisioni errors because the file get's locked out. So you have to create new file. (not helpfull);

You could use automation. shell command?
Ahmed Rashed Amini
Independent Consultant/Developer


blog: https://dynamicsuser.net/nav/b/ara3n

Answers

  • Options
    PhennoPhenno Member Posts: 630
    ara3n wrote:
    Hello
    I'm looking for ideas on how extract the glentries that get posted to fix inconsistency issue. Normaly I use
    message(GLEntry."G/L Account No." + ' ' + GLEntry."Amount");
    

    I've tried to dump the data to file, but navisioni errors because the file get's locked out. So you have to create new file. (not helpfull);

    You could use automation. shell command?


    why don't you make a table (if you have permissions for that) and than enter values into that table rather then into the file?

    I had similar problem and new table helped.
  • Options
    ara3nara3n Member Posts: 9,255
    well if I insert the data into a table, the consistency error will pop up and everything will be rolled back. I want to dump the gl entries to some place.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    PhennoPhenno Member Posts: 630
    ara3n wrote:
    well if I insert the data into a table, the consistency error will pop up and everything will be rolled back. I want to dump the gl entries to some place.


    Indeed. My mistake.

    What about small code that inserts into SQL through ActiveX ADO?
    That should work if you properly open and close connectiong each g/l line.
  • Options
    ara3nara3n Member Posts: 9,255
    Yes that could work, but I don't think it's practical. When you are at client site , you have to create a new table, you have make sure they have the automation. change the connection string. to connect to the db.
    Looking for something more simply and practical.



    Any ideas are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    DenSterDenSter Member Posts: 8,304
    I don't see any other solution than create a new file, with a timestamp in the filename or something.
  • Options
    krikikriki Member, Moderator Posts: 9,096
    In case you are working on SQL, put a CONFIRM just before the error. Let Navision stop there, open a new session and you can see the data written.
    (But something lets me think you aren't working on SQL... so I would go with the solution of Denster)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    PhennoPhenno Member Posts: 630
    AFAIK, Codeunit "417 Start Company Notes" in 3.6 Nav is always loaded...

    So, you could make new function in this codeunit (actually, few of them) open file in that function, than in codeunit 12, you send whole record to 417 function that will write to file.

    You will have to adjust Codeunit 1 cause you want to ensure that file is opened (on Navision Login) and closed (on Navision Logout).


    I don't know what are prerequisits for use of codeunit 417 and, note that i'm talking of Navision 3.60... Not sure will it work on 4.x
  • Options
    ara3nara3n Member Posts: 9,255
    I will try the single instance codeunit. Good Idea. =D>
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    ara3nara3n Member Posts: 9,255
    Hello Wanted to Give an update on this. Used single instance and it worked.
    Here is my code.

    New Codeunit 50090 Single Instance. Insert is a new function.
    OnRun()
    IF TempGLEntry.FIND('-') THEN
      FORM.RUN(0,TempGLEntry);
    
    Insert(LGLEntry : Record "G/L Entry")
    TempGLEntry := LGLEntry;
    TempGLEntry.INSERT;
    

    in codeunit 12 in finishcodeunit function added the following code
          .....
          GLEntry.INSERT;
          //S001 start
          cu50090.Insert(GLEntry);
          //S001 End
    



    After posting the order and get the inconsistency error.

    Run codeunit 50090 and you'll see all the GL Entries. :lol:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    DenSterDenSter Member Posts: 8,304
    That opens all kinds of possibilities :-k
  • Options
    ara3nara3n Member Posts: 9,255
    what kind of possibilities?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    PhennoPhenno Member Posts: 630
    I checked a code a little bit (for another reasons that I wrote in posting prediction thread).

    I tested it with breaking of transaction in posting procedure and, my test data is still in temp table.

    Is this mean that temporary records are not rolled back on transaction break?
  • Options
    ara3nara3n Member Posts: 9,255
    I think I've answered your question in the other thread.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    PhennoPhenno Member Posts: 630
    ara3n wrote:
    I think I've answered your question in the other thread.


    sorry, my bad. first I saw this thread then the other one.
  • Options
    ara3nara3n Member Posts: 9,255
    No problem.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    DnealDneal Member Posts: 103
    Hi,

    I'm trying to get this single instance codeunit to work for me, but I seem to keep getting a duplicate entry error. It seems the codeunit tries to write to the G/L Entry table. I am still a little weak on my programming but I thought the single instance codeunit saved the entries to a temp table and not the actual g/l table.

    Hoping someone can tell me what I have overlooked. ](*,)

    Dneal
  • Options
    ara3nara3n Member Posts: 9,255
    Did you set the tempglentry variable to to temp?

    Also are you deleting the entry no once the form is closed?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    DnealDneal Member Posts: 103
    Hi ara3n,

    I didn't set the tempglentry variable to temp, once I did everything worked superb! I have to admit that was a new property for me. Thank you so much for your idea and your help, it is greatly appreciated!

    Dneal
  • Options
    ara3nara3n Member Posts: 9,255
    You are welcome. I allways double check variable that temp records. Otherwise big booboo
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    gdkve9gdkve9 Member Posts: 161
    Hi

    Can some one suggest me on how to clear the temporary records inserted for G/L entry using the SingleInstance codeunit.

    This case is for,

    I have run the SingleInstance Codeunit once to analyse the Inconsistency and now I am able to reslove the problem. Again for another transaction, I am facing the same inconsistency problem. But when I run the codeunit, it still shows the old records which got inserted for first transaction.

    Now I need to clear these records and would like to know the entries for second transaction.

    Please suggest. Thanks in advance to all.
    Dilip
    Falling down is not a defeat..defeat is when you refuse to get up.
  • Options
    krikikriki Member, Moderator Posts: 9,096
    You need to create a function in the singleinstance codeunit that deletes the records in the temptable.
    And before you run the whole thing, you need to call that new function.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    ara3nara3n Member Posts: 9,255
    Create a new function in Single Instance codeunit called. DeleteTempGLEntries.

    In this function delete Tempory entries.




    Add a buttom somewhere and call this function.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.