Calling another codeunit in the RTC, getting strange error

rjsfrjsf Member Posts: 17
edited 2013-04-13 in NAV Three Tier
Hi All,

I created a simple "browse" page with one field named "Filepath" using AssisEdit to open a browse dialog. I made an action that has the following script:

Do Import - OnAction()
IF Filepath<>'' THEN
BEGIN
GlobalImport.InitVars;
IF GlobalImport.ImportCSVFileNoLog(Filepath)<>0 THEN
MESSAGE('Error encountered importing file. Please check the log for details.')
ELSE
MESSAGE('File ' + Filepath + ' imported');
END;

Where GlobalImport is a codeunit I've made that has all the code to do the import procedure.

Now when I run the page from the Object Explorer, it opens up the page in RTC just fine. I browse for a file and then click on the "Do Import" action that I've just made.

Now I'm getting this funky error message:

The server "net.[url=tcp://localhost:7046/DynamicsNAV/Service]tcp://localhost:7046/DynamicsNAV/Service[/url]" is either unavailable or your connection has been lost. Do you want to attempt to reconnect?"

I'm new to development in RTC, so I may have just missed something. Can anyone give me any clue? :?

Thanks in advance!

Comments

  • rjsfrjsf Member Posts: 17
    Admin, I'm sorry I realized I probably should have posted in the other forum. If so please feel free to move my topic there.
  • ta5ta5 Member Posts: 1,164
    Hi
    I've seen this message a few times before. It occurs imho if something goes wrong with filehandling, might even be the message command itself.
    Try to change your code until the error disappears, then go forward again.If you use NAV 2013 you easy can use the debugger, if you use NAV 2009 debugging becomes a bit harder (search in this forum).
    Hope this may help a bit.
    Thomas
  • DakkonDakkon Member Posts: 192
    I have not yet had a chance to do much with role tailored (so take this with a grain of salt). Given that most everything on role tailored occurs on server side, I seem to recall that there is a little extra effort involved if you want to act upon files on the client machine. If you are already doing this, or I'm wrong, feel free to ignore me ;). I'm sure somewhat more familiar with role tailored can address this better.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
    [Topic moved from 'NAV/Navision Classic Client' to 'NAV Three Tier' forum]
  • kauffmannkauffmann Member Posts: 56
    A few tips:

    Error message means there was an error condition on the server. Check the Event Viewer on the NAV Server, in most cases there is a more detailed error logged there.

    Most likely, there is something wrong in the GlobalImport Codeunit. Compare your code with Codeunit 419. Or even better: try to use Codeunit 419 instead of writing your own functions. Most of the standard filehandling between client and server can be done with this Codeunit.

    Last tip: if you want to track the position in the code where the error occurs, then use the debugger (I assume you are using NAV 2013).
    A good programmer makes al the right mistakes
    My blog
Sign In or Register to comment.