BAM - Progress program question

Thank! That works great! Did a little tweaking, our sales
people with be very happy!

Norman









[Non-text portions of this message have been removed]
Happy Friday Everyone!

Question about a progress program I wrote for a BAM. The BAM is based
on a checkbox in the ordered table, if checked it sends out an e-mail
alert that a new order has been made. It has been working well for
about 6 months until it start acting up with certain orders. I have
figured out that it is because I have called out OrderHed.RequestDate
but that field is not being filled in on all orders because each line
sometimes has a different date. So I wanted to add an IF THEN ELSE to
either print the request date or print "see below" and then list each
lines dates. However I have not at any luck getting it to work.

Here is the code; anyone have any thoughts?

Thanks in advance!

{ud/GlbAlert.i &TableName = "OrderHed"}
DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
FIND Customer WHERE(Customer.Company = OrderHed.Company) AND
(Customer.CustNum = OrderHed.CustNum)
NO-LOCK.
FIND OrderDtl WHERE (OrderDtl.Company = OrderHed.Company) AND
(OrderDtl.Ordernum = Orderhed.OrderNum)
NO-LOCK NO-ERROR.

/*Dont send email if "SEND EMAIL" checkbox is not checked */
If NOT (orderhed.checkbox02) THEN DO:
RETURN "CANCEL SEND":U.
END.

/* Create email */
ASSIGN Email-To = "nhutchins@..."
Email-Subject = "New Order# " + STRING(OrderHed.OrderNum)
/* Create the new body of the email */
NewEmailBody = "~nOrder Number: " + STRING(OrderHed.OrderNum)
+ "~n~nCustomer: " + STRING(Customer.Name)
+ "~n~nShip By: " + STRING(orderhed.RequestDate)
+ "~n~nOrder Date: " + STRING(Orderhed.OrderDate)
+ "~n~nOrder Lines:".
/* Lines of Order */
FOR EACH OrderDtl of OrderHed no-lock:
Assign NewEmailBody = NewEmailBody
+ "~n Item " + STRING(OrderDtl.OrderLine) + ":
" + STRING(OrderDtl.PartNum) + " " +STRING(OrderDtl.LineDesc).
END.

ASSIGN NewEmailBody = NewEmailBody
+ "~n~nSales Person: " + STRING(OrderHed.SalesRepList)
+ "~n~nDO NOT REPLY TO THIS E-MAIl ACCOUNT, IT DOES NOT GET
REVIEW!".
/* Print Email Body */
ASSIGN Email-Text = NewEmailBody
NewEmailBody = "~nOrder Number: " + STRING(OrderHed.OrderNum)
+ "~n~nCustomer: " + STRING(Customer.Name)
+ "~n~nShip By: " + (IF OrderHed.RequestDate = ? THEN "see below" ELSE STRING(orderhed.RequestDate))
+ "~n~nOrder Date: " + STRING(Orderhed.OrderDate)
+ "~n~nOrder Lines:".
/* Lines of Order */
FOR EACH OrderDtl of OrderHed no-lock:
Assign NewEmailBody = NewEmailBody
+ "~n Item " + STRING(OrderDtl.OrderLine) + ":
" + STRING(OrderDtl.PartNum) + " " +STRING(OrderDtl.LineDesc)
+ (IF OrderHed.RequestDate = ? THEN " " + STRING(OrderDtl.RequestDate) ELSE "") .
END.



-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]On Behalf Of howelllabs
Sent: Monday, August 27, 2007 7:04 AM
To: vantage@yahoogroups.com
Subject: [Vantage] BAM - Progress program question



Happy Friday Everyone!

Question about a progress program I wrote for a BAM. The BAM is based
on a checkbox in the ordered table, if checked it sends out an e-mail
alert that a new order has been made. It has been working well for
about 6 months until it start acting up with certain orders. I have
figured out that it is because I have called out OrderHed.RequestDate
but that field is not being filled in on all orders because each line
sometimes has a different date. So I wanted to add an IF THEN ELSE to
either print the request date or print "see below" and then list each
lines dates. However I have not at any luck getting it to work.

Here is the code; anyone have any thoughts?

Thanks in advance!

{ud/GlbAlert.i &TableName = "OrderHed"}
DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
FIND Customer WHERE(Customer.Company = OrderHed.Company) AND
(Customer.CustNum = OrderHed.CustNum)
NO-LOCK.
FIND OrderDtl WHERE (OrderDtl.Company = OrderHed.Company) AND
(OrderDtl.Ordernum = Orderhed.OrderNum)
NO-LOCK NO-ERROR.

/*Dont send email if "SEND EMAIL" checkbox is not checked */
If NOT (orderhed.checkbox02) THEN DO:
RETURN "CANCEL SEND":U.
END.

/* Create email */
ASSIGN Email-To = " nhutchins@shively. <mailto:nhutchins%40shively.com> com"
Email-Subject = "New Order# " + STRING(OrderHed.OrderNum)
/* Create the new body of the email */
NewEmailBody = "~nOrder Number: " + STRING(OrderHed.OrderNum)
+ "~n~nCustomer: " + STRING(Customer.Name)
+ "~n~nShip By: " + STRING(orderhed.RequestDate)
+ "~n~nOrder Date: " + STRING(Orderhed.OrderDate)
+ "~n~nOrder Lines:".
/* Lines of Order */
FOR EACH OrderDtl of OrderHed no-lock:
Assign NewEmailBody = NewEmailBody
+ "~n Item " + STRING(OrderDtl.OrderLine) + ":
" + STRING(OrderDtl.PartNum) + " " +STRING(OrderDtl.LineDesc).
END.

ASSIGN NewEmailBody = NewEmailBody
+ "~n~nSales Person: " + STRING(OrderHed.SalesRepList)
+ "~n~nDO NOT REPLY TO THIS E-MAIl ACCOUNT, IT DOES NOT GET
REVIEW!".
/* Print Email Body */
ASSIGN Email-Text = NewEmailBody







[Non-text portions of this message have been removed]