Navision COM interfaces

2»

Comments

  • DakkonDakkon Member Posts: 192
    I almost have my .Net wrapper project finished, however I have run into one small problem and I thought I'd see if anyone else tinkering with this stuff has also encountered this. I can enumerate the tables for a client just fine and I can also enumerate the records for any of those tables without problem, however, when I try to enumerate the field values for a record or simply get the value for one specific field, I get an exception of RPC_E_SERVERFAULT. Unfortunately, it doesn't tell me anything other than this. Have any of you encountered this, or know a solution? ](*,)
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • kinekine Member Posts: 12,562
    For me it worked. Have you selected company in the NAV client? Is NAV client in idle state (no dialog box, no running report etc.)?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DakkonDakkon Member Posts: 192
    Yes there is a company selected. However, the logic I used to select the active cilents is different than most of the examples I saw. They all have something along the lines of .IndexOf("company=") whereas I did
    if ((runningObjectName.IndexOf("!C/SIDE!navision://client/run?") != -1) && !clientList.Contains(runningObjectVal))
    {...}
    
    I thought that it shouldn't really matter which active object I grab my designer reference from if they are all equal. clientList in the above example is a List<object>. I will try going back to mimicing the other examples and see if it makes a difference.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • kinekine Member Posts: 12,562
    Sometime there are problems around comparing the two running objects if they are the same or not. The running objects are behaving sometime in very strange way. E.g. Window handle of "base" running objects are same (as the first client which was started), even when there are more clients running. Only the database and company "instances" have correct window handle. When you look at ROT from different thread, you will get different "objects" but still same instances etc. Thus I am in my app ignoring the "base" instances and I am working only with the database/company instances. For identifying the instances I am using Process ID connected to the window handle.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DakkonDakkon Member Posts: 192
    Ahh ok I was wondering about that. I had noticed there only seemed to be a reference to the first client of any given set of 2 or more clients that had the same database and company. I will try only grabbing database/company instances and see if I get better results.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • DakkonDakkon Member Posts: 192
    I officially submitted the first release of my wrapper library as a download on the site (I entitled it "C/Side Integration Utilities"). The source code for the project as well as my personal signed binaries and help file are available for download off my website as well. I look forward to feedback and contributions :). I hope people find this useful. \:D/
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • DakkonDakkon Member Posts: 192
    I figured out another one of the unknown methods, proc6 on the INSAppBase is actually EndTransaction. I have version 1.1 of my utilities up on my website including this change. I will update it in the Mibuso downloads soon as well.
        [ComImport, Guid("50000004-0000-1000-0010-0000836BD2D2"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        internal interface INSAppBase
        {
            int GetTable([In] int tableNo, [Out, MarshalAs(UnmanagedType.Interface)] out INSTable table);
            int GetInfos(out string servername, out string databasename, out string company, out string username);
            int StartTransaction(); //start the write transaction in the client
            int EndTransaction([In] bool commitChanges);
            int Error([In] string message);  //Display error in client, roll back the transaction
            int EnumTables([In, MarshalAs(UnmanagedType.Interface)] INSCallbackEnum a, [In] int tableNo); // tableNo is either a specific table number or 0 for all tables
        }    
    
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • DakkonDakkon Member Posts: 192
    One of the users of the utilities brought something to my attention that I felt everyone should be made aware of. It seems there is a rather large bug in the Navision DLL. The export method, that allows exportation of an object in text format, incorrectly writes the caption of the object in place of the name in the exported file. I'm sure everyone can see how bad this is if you are then editing that file and uploading it back. I will be making a change to my utilities to correct this issue, but anyone using the Navision DLL directly should be aware of this problem.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • kinekine Member Posts: 12,562
    It is already known and described in the forum. Just use the second function which takes the filters and it will work correctly (it is not only name of the object but options etc...)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DakkonDakkon Member Posts: 192
    Thanks, I was not aware that it was a known issue but I have since been notified by another user as well :)
    These are the reasons I'm glad to be part of a community because I would not have realized that solution otherwise or at least not without lots of headache ;)
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • AnonymousAnonymous Guest Posts: 137
    Hi !

    Is there any chance to get the selected lines from the Object Designer with the COM Interface? Has anyone a workaround?

    Or is the solution to use the NativeWindow methods?

    thanks and Greetings
  • kinekine Member Posts: 12,562
    I will try to not to uncover the truth directly:

    Hints:
    What you can do with any selected entries within NAV and which functionality you can trigger from outside for any selected thing? And you can do that with selected objects outside NAV too... :-) try think about it and you will find the way... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • AnonymousAnonymous Guest Posts: 137
    I haven't really understand your answer, but i think there isn't a solution in COM. The only way is over the Handles and NativeWindow, but this is not a really good solution. I dont spend the time to get these rows because NAV 7 knocks on the door and ROT and Classic is dead.

    Ok i thought there is a fast way to get a solution but over the handles it cost to much time. Our external Editor works fine without this feature.

    Thanks for the answer.
  • kinekine Member Posts: 12,562
    You can read the values from outside if you want. NativeWindow is not only way... How you are acting as a user, if you want to take the selected rows and put them somewhere else? ;-)
    I dont spend the time to get these rows because NAV 7 knocks on the door and ROT and Classic is dead.
    All depends on what you are using the ROT. It is not true that classic is dead. It is dead for end-users.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • janpieterjanpieter Member Posts: 298
    Reviving this topic a bit.

    I anyone has more details on solving Zeus question I would also be really interested. Nav7 still works with the 'old' object designer. Kine I took your hint although can't see a thing that can be automated to achieve this. Do you have more hints? :-k

    Also another question has anyone somehow been able to access BLOB fields by using the INS interface? That would really interrest me because currently our home brewn version management system archives the txt as well as the BLOB object from the object table. Archiving the BLOB object has big advantages to archiving txt objects when you restore an archived object into a database all renamed functions / fields / objects that are referenced in the object get updated automatically.

    I'm currently using C/AL code to export the BLOB field however I have to move this functionality to .NET libraries because I can't execute C/Al code anymore in the new NAV7 development environment. Anyone has ideas?

    Many thanks for any help!
    In a world without Borders or Fences, who needs Windows and Gates?
  • kinekine Member Posts: 12,562
    Regarding the hint. As a user, you "switch to the client (activate the client window), Select the rows, Ctrl+C" - now are some data in clipboard. Everything could be automated from outside application if you are able to use Win32 libraries (or use can select the rows before he trigger this, you can than just skip the step and keep the rest)... ;-)

    Instead exporting the BLOBs, you can of course export .fob. This of course will be possible in NAV 2013 too in some way 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • janpieterjanpieter Member Posts: 298
    Thanks Kine for the input. I don't want to use the clipboard because it is anoying for the user since it overwrites existing clipboard content.
    Also the rows do have to be selected. If you use CTRL+C while standing on a field only the content of the field is copied.
    I was hoping (and am convinced there must be) another option to achieve this.

    Regarding BLOB, yes in C/AL you can export a FOB. However I can't use C/AL anymore in the development environment. This is only possible in the RTC client which is not where you develop. I was hoping if this could be achieved by using the INS interface.
    In a world without Borders or Fences, who needs Windows and Gates?
  • kinekine Member Posts: 12,562
    Regarding the clipboard - cothing easier than backup the current clipboard, do the process, restore back the clipboard... ;-)

    Regarding the fob/blob - all ways which exists are somehow complicated. Using ROT table have limits. Using classic client and SendKeys is a way, but... Of course, still you can use webservices to run the C/AL Code where you need, but of course, you need WS for each DB. It means that you have differet ways based on the version. And in NAV 2013 there will be new ways. Yes, it is hard to do something. :whistle:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • janpieterjanpieter Member Posts: 298
    You are right Kine. Clipboard should be possible in addition with a few automated keystrokes. I will consider this. Thanks.

    Regarding the BLOB if I could use ROT it would be ideal like you said because it is version independant. Also I would have backwards compatibility with our current system because the BLOB's stored in our archive would still work. Using this system if by far most ideal.

    The webservice will work although it requires more installation and configuration. I'm afraid INS won't help me. I will also be experimenting with using table triggers like OnInsert or field validation triggers and hopefully it will run when inserting a record / modifying a field with the INS interface, although I'am afraid it won't do that in NAV7. It does however in earlier versions.

    Using sendkeys just doesn't seem relyable enough and also too much interference with the UI. I will also consider the possibility to grab the BLOB directly from the SQL database.

    I'm experienced with .NET programming and I will be able to cope with technical challenges, however the only thing troubeling is that sometimes you are limited by your own imagination.
    In a world without Borders or Fences, who needs Windows and Gates?
  • overdrive2012overdrive2012 Member Posts: 1
    Hello everybody, I´m a new member in this great forum, I'am from Germany and try to find how to use this Interfaces: INSAppBase, INSTable, INSCallbackEnum to read the data from some navision's table. Could you help me please, do you have some c# example ? Thank you very much.
  • DakkonDakkon Member Posts: 192
    So this is year late, but just in case it is still relevant to anyone, my c/side integration dll project is in C# if anyone wants an example of how to use this in C#. The project is also open source so you can download it and do what you wish with it. The source code is hosted on my website at http://edgerunner.org/projects/cside-integration-utilities.html. And yes ...I've been horribly delinquent in posting an update to the library project #-o
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
Sign In or Register to comment.