Access Nav data from RTC add-in

Steve_ContrisSteve_Contris Member Posts: 114
edited 2012-08-28 in NAV Three Tier
I am trying to find examples of how to access Navision data and variables from an RTC add-in. So far, all I am finding is information about how add-in controls use SourceExpr to access the single data item they are attached to. How do you access anything else?

I am trying to conditionally control the background color of a control
What would Elvis do?

Comments

  • deV.chdeV.ch Member Posts: 543
    You can't acces anything else in NAV2009, in NAV2013 you will be able to define methods that you can call from within NAV, then you can pass your NAV variables to the addin.

    In NAV2009 you pass data generaly in XML Format through a BigText (at least i did it like this for all my addins).
    Then i parse them in the addin and use the data.
  • AvallackAvallack Member Posts: 18
    deV.ch wrote:
    You can't acces anything else in NAV2009, in NAV2013 you will be able to define methods that you can call from within NAV, then you can pass your NAV variables to the addin.

    In NAV2009 you pass data generaly in XML Format through a BigText (at least i did it like this for all my addins).
    Then i parse them in the addin and use the data.

    Idem, on msdn web site, there is a good explanation about Addin. You can pass a BigText or XmlFile Path ...your addin could open with Dotnet method, it's very easy. Moreover, you can found an Addin Template for Visual Studio with a tutorial.
    Navision Technical Consultant & .Net Developer
  • Steve_ContrisSteve_Contris Member Posts: 114
    I am wanting to change the background of a control conditionally. For example, if the Sell-to city is not the same as the Ship-to City, I want to make the background of the control for the Sell-to City a special color. How can I pass both those fields in to the addin control? Also, what particular event should I override in the addin to perform the background change? I tried ControlAdded but that didnt seem to get called. I tried TextChanged but that gets called too many times as the page is drawn.

    In the addin code the CreateControl function does not seem to get the data (text) passed to it so I can't do it there.
    What would Elvis do?
  • Steve_ContrisSteve_Contris Member Posts: 114
    I hunted around in msdn for examples but did not have much luck can someone give me some links?

    I actually got something working - sort of. I used WinFormsControlAddInBase to build it and I pass the data in a Nav text variable that is used for SourceExpr. The Nav text variable contains several data fields and using that I can cause the background of the control to change based on the data. It works fine except when it comes to writing data back. Since the SourceExpr is no longer a single field from the record, how do I accomplish writing anything back?
    What would Elvis do?
  • deV.chdeV.ch Member Posts: 543
    You call the method RaiseControlAddInEvent(index, data);
    This calls the nav trigger OnControlAddin() where you receive the same parameters (index, data)
  • Steve_ContrisSteve_Contris Member Posts: 114
    Once I had the declaration of my class object correct, I was able to use the RaisControAddInEvent to get the data written. I needed to use StringControlAddInBase to see that.

    thanks for the responses and help
    What would Elvis do?
Sign In or Register to comment.