NetTalk Central

Author Topic: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)  (Read 4757 times)

koen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
In example 31 (Accounts): when a LineItem has been changed or a new record inserted, the LineItems Browse is refreshed, but the Invoices Browse is not refreshed automatically. I have to do that manually.
How can I make it automatically refresh the invoicebrowse after the LineItems file is changed? (i.e.not via a button).

Cheers,

Koen

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Hi Koen
In the Invoice browse in the Inside Browse loop validate record embed call a source procedure
something like result = InvoiceTotal(InvoiceID)
In the source procedure loop through the records in the line item file restricted to the invoiceID and total any values applicable to the invoice.
I  read the invoice record in the source procedure change the values based on the totals and  then update the invoice
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

koen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Hi Terryd,

The BrowseInvoices procedure returns a  page with two browses. Between these two browses exists a parent – child relationship. The first browse is the invoice browse (parent), the second browse is the line-items browse (child).

When I update or insert into the child browse (line-items), this child-browse itself is refreshed, but the parent browse (Invoices) is not refreshed.

If the whole page is refreshed manually (in the InternetBrowser), then the first browse will also be refreshed and will show the new situation. So I thought the easiest solution was to refresh the whole page after the update either via a javascipt (window.location.reload) or by calling the BrowseInvoices procedure again.  But unfortunately I cannot find the right embed to code this refresh.

Cheers,
Koen

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Hallo Koen,

Do you use popup form to update the child?

Robert

koen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Hi Robert,

Yes, I use a popup form.

Cheers,

Koen

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Hi Koen
After you click the save button on an entry in the child browse the parent browse is refreshed (probably not the right word ) each of the lines displayed are validated so after clicking save each parent browse line is revalidated so that the source procedure will be called for each line displayed including the parent record of the child record added or amended
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
ok, then in the form on PostUpdate embed put name of parent browse and (p_web) at the end.

From accounts example:
BrowseInvoices(p_web)

It should work.
Robert

koen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Hi Robert,

It indeed works.
Thanks.

Cheers,

Koen