Timer in subform

ib000904ib000904 Member Posts: 19
We got one main form which contains two subforms, each looking at the "Sales Line"-table from different views.
How can we make all forms show additions to the sales lines almost immediately as they are entered in the database?
Looks like the 'ontimer' property (with CurrForm.Update the on_timer section of the C/AL) only functions for the active form, but we also want the inactive ones to be updated.

Comments

  • XypherXypher Member Posts: 297
    Using the Timer for the Main Form, Update the form as well as call functions to the Subforms which would cause them to Update.
    Form - OnTimer()
      CurrForm.UPDATE;
      CurrForm.SubForm.UpdateTableFunction;
      CurrForm.OtherSubForm.UpdateTableFunction;
    

    Or if this will do the trick (not sure off the top of my head), CurrForm.SubForm.UPDATE, called from the Timer event.
  • warraxwarrax Member Posts: 25
    ib000904 wrote:
    We got one main form which contains two subforms, each looking at the "Sales Line"-table from different views.

    Do I understand correctly - all 3 forms look at the "Sales Line" table, or only the two subforms?
    ib000904 wrote:
    How can we make all forms show additions to the sales lines almost immediately as they are entered in the database?
    Looks like the 'ontimer' property (with CurrForm.Update the on_timer section of the C/AL) only functions for the active form, but we also want the inactive ones to be updated.

    If it is all 3 forms, can you make new entries in all 3 or only the main form?

    Also, do you see both subforms at all times, or only one of them (like on a Tab-control maybe)?


    If the insert is only allowed on the main form, then it's easy. Just call an update to Currform.Subforms.UpdateFunction (where UpdateFunction contains the code "Currform.Update(false);") in the OnAfterGetCurrRecord Trigger.

    If you can edit on the subforms as well, then the best (besides the timer) you can do, is on the Subform.OnDeactivate, call a Currform.Update AND Currform.otherSubform.UpdateFunction.
Sign In or Register to comment.