Options

Regarding display a list of error in a page in NAV 2009

bharathnanbharathnan Member Posts: 92
I want list the error which all we are getting when we try to run a report or forms in page using RTC in nav 2009,...
Can anyone help me with this..
Thanks in advance

Answers

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Not sure what you exactly want to achieve.. If you want to have a complete list of actual errors which could be potentially thrown from a code then, no, can't do.

    If you you want to catch an error thrown from the code then there are a few ways to do that.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    bharathnanbharathnan Member Posts: 92
    Actually when transferring data from a table to another table which has same field name with different data types ,it throws some error which field has different data type but the values of other data types are not transffered ........Here I want the data of the remaining fields also to be transfered and also the error must be captured and must be displayed in a page.

    Thanks in Advance...
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-12-11
    You can make a very simple function just meant to transfer the data between records, and mark it as a TryFunction
    TryFunction
    TansferData(FromRecord, Var ToRecord)
    BEGIN
      ToRecord.TRANSFERFIELDS(FromRecord)
    END
    
    Then use it in yor code
    IF NOT TansferData(FromRecord, ToRecord) THEN
      //handle the error here
    

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    bharathnanbharathnan Member Posts: 92
    ok thanks for the answer i will check on that
  • Options
    bharathnanbharathnan Member Posts: 92
    Sorry to say that i am a beginner and what you have answered me is too far to understand ,can you explain it elaborately ..

    thanks in advance
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-12-11
    1. Edit an object
    2. Create a new TansferData function in it
    3. Click Properties (or press Shift+F4) while your function is highlighted in C/AL Globals window
    4. Change TryFunction Propery to Yes

    Then add parameters, make sure the parameter where you will be passing your output table is marked as Var

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    bharathnanbharathnan Member Posts: 92
    I searched for the tryfuction property in NAV but it is not present there ...and i am currently using nav 2009 or 5.0 version can you suggest answers regarding to my version

    Thanks in advance
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-12-12
    If you have NAV 2009 why have you posted in NAV Three Tier forum then?

    Anyway, you will need a separate codeunit for that.

    Make two global variables in the codeunit, one of type FromRecord, another of type ToRecord, make two functions in in SetFromRecord which will set the global FromRecord to whatever is passed in the call, make function GetToRecord, which wll return global ToRecord, in OnRun trigger put put your GlobalToRecord.TRANSFERFIELDS(GlolbalFromRecord)

    In your code where errors needs to be detected create variable of type of the codeunit, when you need to transfer the data cal this
    MyCu.SetFromRecord(MyFromRecord)
    IF MyCu.RUN THEN
      MYCu.GetToRecord(MyToRecord)
    ELSE
       //handle the error here
    

    Having said that I'd rather suggest to redesing your records to make field numbers, types and lenghts matching each other in both tables, so the TRANSFERFIELDS can work without errors, or create your own MyTransferfieldsFrom() function on ToRecord, include as series of simple assignments in it, and instead of using TRANSFERFIELDS call ToRecord.MyTransferfieldsFrom(FromRecord)
    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.