NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: koen on May 18, 2011, 05:17:32 AM

Title: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: koen on May 18, 2011, 05:17:32 AM
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
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: terryd on May 19, 2011, 09:13:36 AM
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
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: koen on May 20, 2011, 12:57:06 AM
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
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: Robert Iliuta on May 20, 2011, 01:49:32 AM
Hallo Koen,

Do you use popup form to update the child?

Robert
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: koen on May 20, 2011, 02:23:11 AM
Hi Robert,

Yes, I use a popup form.

Cheers,

Koen
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: terryd on May 20, 2011, 04:37:36 AM
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
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: Robert Iliuta on May 20, 2011, 04:48:56 AM
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
Title: Re: How to refresh Browseinvoices when LineItems updated or insertd (Example 31)
Post by: koen on May 20, 2011, 06:43:21 AM
Hi Robert,

It indeed works.
Thanks.

Cheers,

Koen