Update a form form a subform

j.stalderj.stalder Member Posts: 35
Hello,

I'd like to open a form from a subform, and when i change the record selected in the subform, the linked form should be updated automatically.

Thanks for your futur answers

Joachim

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    This cannot be done with properties or things like that.

    You need to write some timer functions which updates the forms if required.
  • j.stalderj.stalder Member Posts: 35
    Hi Mark,

    How do you update the form already opened? which function do you use?

    Thanks for your answer
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    You need to write some function that is triggerd by a timer. This can be the timer ocx or the OnTimer trigger.

    In this function you set the condition for the form to update.

    This condition you can store in a singleinstance codeunit.

    From the subform you call a function in the codeunit (SetUpdate)

    This need to set a global variable to true.

    From the to-be-updated from you call a function in the codeunit(DoUpdate)

    This returns TRUE if the global variable is true and sets the variable to false

    Good Luck 8)
  • j.stalderj.stalder Member Posts: 35
    I understand what you mean but what i wanted is the name of the functions to use.

    I tried some time ago to update the form opened form the subform with a setTableView with a new filter on the record passed..

    Hope you understand what i mean

    Joachim
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Yes, I hope I understand, I think :?

    The problem is that most of the functions you need to define yourself.

    From the subform you have a function like
    CopyRec := Rec;
    Form.run(Form::"The Form, Rec);
    
    And one in the OnTimer trigger
    If Codeunit.UpdateMainForm then
      Currform.Update(FALSE)
    

    On the other form you have some function like
    UpdateSubform
    

    Which you activate when the subform needs updating...

    So unfortunately no standard functions here :(
  • j.stalderj.stalder Member Posts: 35
    Hi,

    I'll have a look to your solution as soon as i have some time

    I let you know if it work how i wanted

    Thanks

    Joachim
Sign In or Register to comment.