Options

You cannot make any changes in the database until a tran...

Slawek_GuzekSlawek_Guzek Member Posts: 1,690
Hi all,

Some of you probably saw the error:
You cannot make any changes in the database until a transaction has been started.
This error apperas when you try to insert anything into database in OnInit trigger, or OnURL trigger on the form.

Is this a bug ? or is there any official MS document saying: yes - this behaviour is by design. If it is a bug does anyone report this to MS ?

Regards,
Slawek
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,096
    Hi all,

    Some of you probably saw the error:
    You cannot make any changes in the database until a transaction has been started.
    This error apperas when you try to insert anything into database in OnInit trigger, or OnURL trigger on the form.

    Is this a bug ? or is there any official MS document saying: yes - this behaviour is by design. If it is a bug does anyone report this to MS ?

    Regards,
    Slawek
    And also in the OnAfterGetRecord-trigger. This is normal behaviour. I don't know where it is written, but if I would want to see it, I would start looking in w1w1adg.pdf.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    And also in the OnAfterGetRecord-trigger. This is normal behaviour. I don't know where it is written, but if I would want to see it, I would start looking in w1w1adg.pdf.

    I was so smart to look there, but not smart enough to find anything regarding inserting new data in OnInit or OnAfterGetRecord.

    I was smart enough to find on p.277 w1w1adg.pdf an example of C/AL code showing usage of MODIFY in OnAfterGetRecord, which actually doesn't work :mrgreen: .

    I'm wondering if it is an error because NAV throws an error even if one tries to insert/modify the data in the table completely unrelated to the form.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    krikikriki Member, Moderator Posts: 9,096
    I'm wondering if it is an error because NAV throws an error even if one tries to insert/modify the data in the table completely unrelated to the form.
    No it isn't. That trigger is ONLY for getting (=reading) some info from the DB to be shown on the form. It has no sense writing data in that moment. Also because you would create a LOT of writes to the DB creating performance problems.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    kriki wrote:
    I'm wondering if it is an error because NAV throws an error even if one tries to insert/modify the data in the table completely unrelated to the form.
    No it isn't. That trigger is ONLY for getting (=reading) some info from the DB to be shown on the form. It has no sense writing data in that moment. Also because you would create a LOT of writes to the DB creating performance problems.

    That's true in case of OnAferGetRecord. But what about OnInit and OnURL ? And why w1w1adg.pdf says that MODIFY is possibble in OnAferGetRecord :-k
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    yes - this behaviour is by design.

    What you need is a very very slow connection to the NAV server.

    Try connectiing direct over a slow interent connection.

    Then open a form with complex captioning. It then becomes clear what it is drawing it what sequence (or use the dubegger but uuurrrggghhh).

    Of course it would sometimes be nice to be able to cption a field once you have the record, but I think in balance it would just add too much performance over head to have that ability for the one in 100,000 times that its needed.
    David Singleton
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    :?: :shock: :?: :shock: :?: :shock:
    :-k

    David, could you please be more specific ? I can't figure out to what your answer is related to...
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    David, could you please be more specific ? I can't figure out to what your answer is related to...

    My first laptop that I used for many of my Navision impelmentations was a 486 16mhz with 12 meg of ram.

    Because it was quite slow, making things go fast were very important to me. (It probably is patially why now I am so good at making NAV systems go fast).

    have that computer I saw many things that you never see on a fast computer, and one of them is how Forms are drawn in Navision. So i you have a slow connection to the server you can emulate this slow speed,a nd you can see what is happening when a form opens in slow motion, and see what takes the most time etc.

    This can help you understand why they do it this way. using the debugger is not the same because one key stroke of F8 or f5 could be 1 milli second or 1 second you dont know.
    David Singleton
  • Options
    Mister_BMister_B Member Posts: 1
    in a report you can use the follow trick :

    Report - OnInit
    CLEARALL;
    codsite := cunPLATOUserSite.fct_Return_DefaultSite;
    recPLATOSetup.GET('');
    IF recPLATOSetup."Invoice file number" = '' THEN
       ERROR(textFileNumber);
    txtFile := INCSTR(recPLATOSetup."Invoice file number");
    

    Report - OnPre
    recPLATOSetup."Invoice file number" :=txtFile;
    recPLATOSetup.MODIFY;
    COMMIT;
    
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Mister B wrote:
    in a report you can use the follow trick :
    Now you don't have to.

    Microsoft has finally solved that problem in hotfix 954722 posted in April 2009.

    Exe build number is 5.0.27253.0

    Regards,
    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.