Help with BPM 4GL date calculation

You need to use the datediff function


Kersten MacLennan
IT/ERP Analyst
Semrock, Inc.
3625 Buffalo Rd.,
Suite 6
Rochester, NY 14624
585-594-7009
585-594-7095 fax

kmaclennan@...

The Standard in Optical Filters for Biotech & Analytical Instrumentation


Hundreds of Thousands of Ion Beam Sputtered filters delivered -
extensive inventory now!

The information contained in this message and any attachments may be
privileged, confidential, and protected from disclosure. If the reader
of this message is not the intended recipient, or any agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution, or copying of this
communication may be unlawful and therefore strictly prohibited. If you
received this message in error, please reply to the message and delete
it. Thank you




________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of dansirow
Sent: Tuesday, March 11, 2008 10:51 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Help with BPM 4GL date calculation





I am trying to write a BPM to calculate the number of days on average it
takes a customer to pay our invoices. These fields will be shown on the
Customer Credit Manager Sheet. My problem is Customer.Number03 is
always blank. Is there a problem with subtracting dates? Number02 is
updating okay.

Define variable count as integer init 0.
Define variable total as integer init 0.
Define variable average as integer init 0.

find customer where Customer.Company = "ICC" and Customer.CustID =
CustID exclusive-lock.
if available customer then do:
for each InvcHead where InvcHead.Company = "ICC" and
InvcHead.OpenInvoice = False and
InvcHead.Custnum = Customer.CustNum and InvcHead.InvoiceDate >
Today - 365 no-lock.
Assign count = count + 1.
Assign total = total + InvcHead.ClosedDate - InvcHead.InvoiceDate.
End. /*for*/

Assign average = total / count.

run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE,
"Number03",average).
run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE,
"Number02",count).
end. /*do*/






[Non-text portions of this message have been removed]
I am trying to write a BPM to calculate the number of days on average it
takes a customer to pay our invoices. These fields will be shown on the
Customer Credit Manager Sheet. My problem is Customer.Number03 is
always blank. Is there a problem with subtracting dates? Number02 is
updating okay.

Define variable count as integer init 0.
Define variable total as integer init 0.
Define variable average as integer init 0.

find customer where Customer.Company = "ICC" and Customer.CustID =
CustID exclusive-lock.
if available customer then do:
for each InvcHead where InvcHead.Company = "ICC" and
InvcHead.OpenInvoice = False and
InvcHead.Custnum = Customer.CustNum and InvcHead.InvoiceDate >
Today - 365 no-lock.
Assign count = count + 1.
Assign total = total + InvcHead.ClosedDate - InvcHead.InvoiceDate.
End. /*for*/

Assign average = total / count.

run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE,
"Number03",average).
run lib\UpdateTableBuffer.p(input BUFFER Customer:HANDLE,
"Number02",count).
end. /*do*/