Referencing parent form from subform

davidecdavidec Member Posts: 63
Hello!

Is there any way I can reference one particular instance of a form from another?

In my case, I have a subform which is used by one parent. The parent calls a subform's method which returns a variable. That variable is used as the source of a Textbox. When events occur in the parent, the subform's method is called and the parent's textbox value is updated. No problem if events originate just in the parent, but I've been asked to originate one from the subform, which should be able to update the parent's checkbox in response...

Even refreshing the parent form could be enough...

Thank you very much in advance!

PS: I had an architecture ready for what I had been asked, a new requirement emerged, that forces me to implement the behaviour I'm asking about. Changing too much could not be feasible...

Comments

  • ara3nara3n Member Posts: 9,256
    You could add code ontimer of the parent form. otherwise it's not possible.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    There is a way... and it is easy...s ee Garak's answer there: viewtopic.php?t=22564

    using MSXMLDom...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    That's clever, using events. Learned another way to get around nav limitation.
    I am guessing to make this work on nav 2009 because onaftervalidate trigger is no longer part of Page, you could use onvalidate.instead.

    You have to instantiate the msxmldom on the client.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • davidecdavidec Member Posts: 63
    Thank you very much for your suggestion on MSXMLDom, but I figure I can't use this approach: does this mean that if I link to version, say, 4, all clients need to have that version installed? If they installed version 5 and wanted to remove version 4, would my code break? If so, I can't rely on that: part of the clients will be software developers (not only NAV) and they/I need to do some "mess" with installed libraries at times...

    Rather, a solution that Garak didn't like, was using single instance codeunits: is the instance single on a client or on the server? Were it on the client, I could use that approach...

    Thanks again!
  • davidecdavidec Member Posts: 63
    Ok, I managed to achieve my goal playing with onActivate and onDeactivate...
  • kinekine Member Posts: 12,562
    davidec wrote:
    Thank you very much for your suggestion on MSXMLDom, but I figure I can't use this approach: does this mean that if I link to version, say, 4, all clients need to have that version installed? If they installed version 5 and wanted to remove version 4, would my code break? If so, I can't rely on that: part of the clients will be software developers (not only NAV) and they/I need to do some "mess" with installed libraries at times...

    Rather, a solution that Garak didn't like, was using single instance codeunits: is the instance single on a client or on the server? Were it on the client, I could use that approach...

    Thanks again!

    I am not sure, but I think that XMLDOM 4.0 is installed as part of NAV client installation...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.