How to call from subform function of a form.

TimofeiTimofei Member Posts: 9
edited 2006-06-21 in Navision Attain
Hello all.
Our developer is now trying to make "interactive statistics" in sales order, so he made a subform in the header of a sales order with some statistics in it. But to updait statistics you have to press button on a form. And I would like to have values changed in statistics subform when I changed values in sales line.
Developer says that it's impossible to call form's functions from subform and so no interactive statistics within standard Attain.
So, if you have any ideas about subj - share them.

Thank you
Timofei

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Your developer is right, you can't. The only way is to use the OnTimer-trigger on the main form, so it can update the form at regular intervals. But this will slowdown your system.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • TimofeiTimofei Member Posts: 9
    Many thanks
    We will try OnTimer and see how it affects performance.
  • memulamemula Member Posts: 30
    Hello all !

    Timofej, why you don't whant to use a variable of FORM in SUBFORM ?
  • HalMdyHalMdy Member Posts: 429
    memula wrote:
    Hello all !

    Timofej, why you don't whant to use a variable of FORM in SUBFORM ?

    And how do you make that ?

    If you have the "magic solution" for this point, I think everybody here will be happy to read it ... As far as we know (and many other threads are here to confirm), it's impossible ...
  • memulamemula Member Posts: 30
    It is possible that i don't know the ditails of the task. But there is nothing wrong if you create variable of the parent type FORM and than you can call any that function you want. If you want to get current record i got solution for it.

    but it litlle bit tricky:

    1) in sub form create function f.e. SetRec(VAR LRec: PARENT REC )
    local vars: PRec (PARENT REC)
    PF (PARENT FORM)
    and paste code

    PRec := LRec;
    PF.SETRECORD(PRec);
    //*****HERE IT IS PARENT FORM FUNCTION CALL !!!******
    PF.blablabla();
    //*************************************************

    2) In parent form make name for subform control f.e. "Proba"

    3) Create button and paste code

    CurrForm.Proba.FORM.SetRec(Rec);


    Now every time you push the button it calls it's own function from subform.
    But more simpler i think it to call some subform function and pass variable of subform REC and then make any changes you want.
  • HalMdyHalMdy Member Posts: 429
    OKI ...

    I see ... I misunderstand what you said before... I understood that you could call the parent form from the subform (that's clearly impossible) ...

    Anyway, Thx !
Sign In or Register to comment.