Perfect! This worked great!!
Thanks a ton!
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of ksimon8fw
Sent: Friday, March 05, 2010 9:57 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Progress BAM
Travis,
Not quite. Here's what I'd do. First, use displays in the program, such
as 'MESSAGE "inside of Checkbox IF statement". Then, you can check the
logs to see exactly where your logic isn't getting to. That will likely
help narrow it down a bit for you.
Second, your logic, may work, it's got some extra overhead in it which
you should remove. However, you're assigning the variable NewEmailBody
but never assigning that back to Email-Text. So, you may be building
that correctly but not movnig it back to the Email itself. However, you
don't need that variable anyway.
Here's the logic I would use, I've stripped out the long assign
statements, but this should work:
IF OrderHed.CheckBox02 = TRUE THEN DO:
FIND Customer WHERE ... NO-LOCK.
/* NOTE: you don't need the OrderDtl FIND here, take it out */
FIND ShipTo WHERE ... NO-LOCK.
MESSAGE "Inside of OH.CB02 if statement...".
ASSIGN Email-To = "tlate@..."
Email-Subject = "New Sales Order # " ...
Email-Text = "Items on order number " ...
FOR EACH OrderDtl WHERE ... NO-LOCK: /* Note the colon here */
MESSAGE "OrderDtl loop, line " + string(OrderDtl.OrderLine).
ASSIGN Email-Text = Email-Text + "~n~n...
END.
End.
/* If the order is not shipped */
ELSE DO:
RETURN "CANCEL SEND":U.
END.
One final note: you didn't do any error checking on some of your finds.
That's probably OK, you should never have an order without CUSTOMER. If
for some reason you had data corruption, you won't get the nice error
messages. I'm not sure if you're familiar with the "AVAILABLE"
statement, but you may consider that in there for proper error handling.
In other words:
FIND CUSTOMER ... NO-LOCK NO-ERROR.
IF AVAILABLE Customer THEN DO:
...
END.
ELSE DO:
ASSIGN Email-To = "support@....".
ASSIGN Email-Subject = "ERROR!!...".
ASSIGN Email-Text = "Customer not found on order ...".
END.
Hope that helps!
Kevin
--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"Late, Travis" <tlate@...> wrote:
Behalf
This message is being sent by M-B Companies. It is intended exclusively for
the individuals and entities to which it is addressed. This communication,
including any attachments, may contain information that is proprietary,
privileged and confidential if you are not the named addressee; you are not
authorized to read,print,retain copy or disseminate this message or any part
of it.If you have received this message in error, please notify the sender
immediately by email.
[Non-text portions of this message have been removed]
Thanks a ton!
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of ksimon8fw
Sent: Friday, March 05, 2010 9:57 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Progress BAM
Travis,
Not quite. Here's what I'd do. First, use displays in the program, such
as 'MESSAGE "inside of Checkbox IF statement". Then, you can check the
logs to see exactly where your logic isn't getting to. That will likely
help narrow it down a bit for you.
Second, your logic, may work, it's got some extra overhead in it which
you should remove. However, you're assigning the variable NewEmailBody
but never assigning that back to Email-Text. So, you may be building
that correctly but not movnig it back to the Email itself. However, you
don't need that variable anyway.
Here's the logic I would use, I've stripped out the long assign
statements, but this should work:
IF OrderHed.CheckBox02 = TRUE THEN DO:
FIND Customer WHERE ... NO-LOCK.
/* NOTE: you don't need the OrderDtl FIND here, take it out */
FIND ShipTo WHERE ... NO-LOCK.
MESSAGE "Inside of OH.CB02 if statement...".
ASSIGN Email-To = "tlate@..."
Email-Subject = "New Sales Order # " ...
Email-Text = "Items on order number " ...
FOR EACH OrderDtl WHERE ... NO-LOCK: /* Note the colon here */
MESSAGE "OrderDtl loop, line " + string(OrderDtl.OrderLine).
ASSIGN Email-Text = Email-Text + "~n~n...
END.
End.
/* If the order is not shipped */
ELSE DO:
RETURN "CANCEL SEND":U.
END.
One final note: you didn't do any error checking on some of your finds.
That's probably OK, you should never have an order without CUSTOMER. If
for some reason you had data corruption, you won't get the nice error
messages. I'm not sure if you're familiar with the "AVAILABLE"
statement, but you may consider that in there for proper error handling.
In other words:
FIND CUSTOMER ... NO-LOCK NO-ERROR.
IF AVAILABLE Customer THEN DO:
...
END.
ELSE DO:
ASSIGN Email-To = "support@....".
ASSIGN Email-Subject = "ERROR!!...".
ASSIGN Email-Text = "Customer not found on order ...".
END.
Hope that helps!
Kevin
--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"Late, Travis" <tlate@...> wrote:
>=
> Kevin,
>
>
>
> I get no errors now, but when I receive the email there are still no
> order lines. Am I inserting this incorrectly? Below is what I have.
>
>
>
> {ud/GlbAlert.i &tablename = "OrderHed" }
>
>
>
> DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
>
>
>
> /*new email body*/
>
> IF OrderHed.CheckBox02 = TRUE
>
> THEN DO:
>
>
>
> FIND Customer WHERE Customer.Company = OrderHed.Company AND
> Customer.CustNum = OrderHed.BTCustNum NO-LOCK.
>
> FIND OrderDtl WHERE OrderDtl.Company = OrderHed.Company AND
> OrderDtl.Ordernum = Orderhed.OrderNum NO-LOCK no-error.
>
> FIND ShipTo WHERE ShipTo.Company = OrderHed.Company and ShipTo.CustNum
> OrderHed.CustNum and ShipTo.ShipToNum = OrderHed.ShipToNum no-lockSTRING(ShipTo.Address1)
> no-error.
>
> IF OrderHed.Checkbox02 = TRUE
>
> THEN DO:
>
> ASSIGN Email-To = "tlate@..."
>
>
>
> Email-Subject = "New Sales Order # "
>
> + string(OrderHed.OrderNum)
>
> Email-Text = "Items on order number "
>
> + "~n~n Order Number: " +
> STRING(OrderHed.OrderNum)
>
> + "~n Order Date: " + STRING(Orderhed.OrderDate)
>
> + "~n Your PO Number: " + STRING(Orderhed.PONum)
>
> + "~n Order Total: $" + STRING(Orderhed.CCAmount)
>
> + "~n~n Bill to: " + STRING(Customer.Name) + ", " +
> STRING(Customer.Address1) + ", " + STRING(Customer.City) + ", " +
> STRING(Customer.State) + ", " + STRING(Customer.ZIP)
>
> + "~n Ship to: " + STRING(ShipTo.Name) + ", " +
> + ", " + STRING(ShipTo.City) + ", " + STRING(ShipTo.State) + ", " +[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
> STRING(ShipTo.ZIP)
>
> + "~n Expected Ship Date: " + (IF OrderHed.RequestDate = ? THEN "see
> below" ELSE STRING(orderhed.RequestDate)).
>
> End.
>
> FOR EACH OrderDtl WHERE OrderDtl.Company = OrderHed.Company
>
> AND OrderDtl.OrderNum = OrderHed.OrderNum
>
> NO-LOCK:
>
>
>
> /* Lines of Order */
>
> ASSIGN NewEmailBody = NewEmailBody
>
> + "~n~n~nOrder Lines:~n"
>
> + " Item " + STRING(OrderDtl.OrderLine) + ":~t"
>
> + STRING(OrderDtl.PartNum) + " " + STRING(OrderDtl.LineDesc)
>
> + ":~t" + STRING(OrderDtl.OrderQty) + " piece(s)"
>
> + (IF OrderHed.RequestDate = ? THEN ":~tShip By: "
>
> + STRING(OrderDtl.RequestDate) ELSE "")
>
> + "~n".
>
>
>
> END.
>
>
>
> End.
>
> /* If the order is not shipped */
>
> ELSE DO:
>
> RETURN "CANCEL SEND":U.
>
> END.
>
>
>
> From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Behalf
> Of ksimon8fw<mailto:vantage%40yahoogroups.com> ,
> Sent: Thursday, March 04, 2010 4:16 PM
> To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> Subject: [Vantage] Re: Progress BAM
>
>
>
>
>
> Travis,
>
> I hadn't done the looping through the OrderDtl the way you did.
> Typically, this is the way I've done it:
>
> FOR EACH OrderDtl WHERE OrderDtl.Company = OrderHed.Company
> AND OrderDtl.OrderNum = OrderHed.OrderNum
> NO-LOCK:
> {insert your processing here}
> END.
>
> Note, you don't need a NO-ERROR on this, if it doesn't find any
> OrderDtl, it simply won't process the loop.
>
> Also, I hadn't done the embedded IF within an assign statement. Nice
> trick!
> Let me know if that works.
> Kevin Simon
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> "Late, Travis" <tlate@> wrote:--
> >
> > Rob,
> >
> > There are a ton of error messages, because I've been trying so many
> > things with this .p proragm . Here is a glimpse of what I have for
> > errors:
> >
> >
> >
> > [10/03/04@15:10:14.196-0600] P-000812 T-000552 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Unable to understand after
> > "RequestDate))". (247)--
> >
> > [10/03/04@15:10:14.196-0600] P-000812 T-000552 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 25. (198)
> >
> > [10/03/04@15:10:52.969-0600] P-003016 T-003020 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Unable to understand after
> > "RequestDate))". (247)--
> >
> > [10/03/04@15:10:52.969-0600] P-003016 T-003020 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 25. (198)
> >
> > [10/03/04@15:10:52.969-0600] P-003016 T-003020 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Unable to understand after
> > "OrderDtl.PartNum)". (247)--
> >
> > [10/03/04@15:10:52.969-0600] P-003016 T-003020 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 26. (198)
> >
> > [10/03/04@15:11:17.190-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Unable to understand after
> > "RequestDate))". (247)--
> >
> > [10/03/04@15:11:17.190-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 25. (198)
> >
> > [10/03/04@15:11:17.190-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Incompatible data types in
> > expression or assignment. (223)
> >
> > [10/03/04@15:11:17.190-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 26. (196)
> >
> > [10/03/04@15:12:25.698-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Unable to understand after
> > "RequestDate))". (247)<mailto:vantage%40yahoogroups.com>
> >
> > [10/03/04@15:12:25.698-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 25. (198)
> >
> > [10/03/04@15:12:25.698-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) ** Incompatible data types in
> > expression or assignment. (223)
> >
> > [10/03/04@15:12:25.698-0600] P-001868 T-001052 1 AS -- (Procedure:
> > 'db/trg/OrderHed/WRITE.P' Line:1227) **
> > \\Vantagetest\Epicor\mfgsys803\Server\ud\MBSalesOrder.p Could not
> > understand line 26. (196)
> >
> >
> >
> > From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com> ] On
> Behalf<mailto:vantage%40yahoogroups.com>
> > Of Rob Bucek
> > Sent: Thursday, March 04, 2010 2:28 PM
> > To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> > Subject: RE: [Vantage] Progress BAM<mailto:vantage%40yahoogroups.com>
> >
> >
> >
> >
> >
> > What is your error message?
> >
> > Rob Bucek
> >
> > Manufacturing Engineer
> >
> > PH: (715) 284-5376 ext 3111
> >
> > FAX: (715)284-4084
> >
> > <http://www.dsmfg.com/>
> >
> > (Click the logo to view our site) <http://www.dsmfg.com/>
> >
> > From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> <mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com>
> > [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> <mailto:vantage%40yahoogroups.com> ] On<mailto:vantage%40yahoogroups.com>
> > Behalf
> > Of Late, Travis
> > Sent: Thursday, March 04, 2010 1:17 PM
> > To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
> <mailto:vantage%40yahoogroups.com>to
> > Subject: [Vantage] Progress BAM
> >
> > I set up a .p program to send an email alert to a group designated
> > receive the email when a sales order is checked send email.Everything
> > works fine with what I have below , but I want to add Order lineerror.
> details
> > to this .p program. I would like to add this, but always get an
> > Any ideas how I can add the order lines to this .p?ShipTo.CustNum
> >
> > Thanks in advance.
> >
> > What I'd like to add
> >
> > /* Lines of Order */
> >
> > ASSIGN NewEmailBody = NewEmailBody
> >
> > + "~n~n~nOrder Lines:~n".
> >
> > FOR EACH OrderDtl of OrderHed no-lock:
> >
> > Assign NewEmailBody = NewEmailBody
> >
> > + " Item " + STRING(OrderDtl.OrderLine) + ":~t"
> >
> > + STRING(OrderDtl.PartNum) + " " + STRING(OrderDtl.LineDesc)
> >
> > + ":~t" + STRING(OrderDtl.OrderQty) + " piece(s)"
> >
> > + (IF OrderHed.RequestDate = ? THEN ":~tShip By: "
> >
> > + STRING(OrderDtl.RequestDate) ELSE "")
> >
> > + "~n".
> >
> > What I currently have working
> >
> > {ud/GlbAlert.i &tablename = "OrderHed" }
> >
> > DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
> >
> > /*new email body*/
> >
> > IF OrderHed.CheckBox02 = TRUE
> >
> > THEN DO:
> >
> > FIND Customer WHERE Customer.Company = OrderHed.Company AND
> > Customer.CustNum = OrderHed.BTCustNum NO-LOCK.
> >
> > FIND OrderDtl WHERE OrderDtl.Company = OrderHed.Company AND
> > OrderDtl.Ordernum = Orderhed.OrderNum NO-LOCK no-error.
> >
> > FIND ShipTo WHERE ShipTo.Company = OrderHed.Company and
> =exclusively for
> > OrderHed.CustNum and ShipTo.ShipToNum = OrderHed.ShipToNum no-lock
> > no-error.
> >
> > IF OrderHed.Checkbox02 = TRUE
> >
> > THEN DO:
> >
> > ASSIGN Email-To = "tlate@ <mailto:tlate%40m-bco.com>
> > <mailto:tlate%40m-bco.com> "
> >
> > Email-Subject = "New Sales Order # "
> >
> > + string(OrderHed.OrderNum)
> >
> > Email-Text = "Items on order number "
> >
> > + "~n~n Order Number: " +
> > STRING(OrderHed.OrderNum)
> >
> > + "~n Order Date: " + STRING(Orderhed.OrderDate)
> >
> > + "~n Your PO Number: " + STRING(Orderhed.PONum)
> >
> > + "~n~n Bill to: " + STRING(Customer.Name) + ", " +
> > STRING(Customer.Address1) + ", " + STRING(Customer.City) + ", " +
> > STRING(Customer.State) + ", " + STRING(Customer.ZIP)
> >
> > + "~n Ship to: " + STRING(ShipTo.Name) + ", " +
> STRING(ShipTo.Address1)
> > + ", " + STRING(ShipTo.City) + ", " + STRING(ShipTo.State) + ", " +
> > STRING(ShipTo.ZIP)
> >
> > + "~n Expected Ship Date: " + (IF OrderHed.RequestDate = ? THEN "see
> > below" ELSE STRING(orderhed.RequestDate)).
> >
> > End.
> >
> > End.
> >
> > /* If the order is not shipped */
> >
> > ELSE DO:
> >
> > RETURN "CANCEL SEND":U.
> >
> > END.
> >
> > Travis Late
> >
> > ERP Project Manager
> >
> > M-B Companies, Inc
> >
> > 1200 Park Street
> >
> > Chilton, WI 53014
> >
> > Phone: 920-898-1560 Ext.152
> >
> > Cell: 920-960-0062
> >
> > Email: tlate@ <mailto:tlate%40m-bco.com>
> > <mailto:tlate%40m-bco.com> <mailto:
> > tlate@ <mailto:tlate%40m-bco.com> <mailto:tlate%40m-bco.com> >
> >
> >
> > M-B Companies Confidentiality Notice:
> > This message is being sent by M-B Companies. It is intended
> exclusively
> > for
> > the individuals and entities to which it is addressed. This
> > communication,
> > including any attachments, may contain information that is
> proprietary,
> > privileged and confidential if you are not the named addressee; you
> are
> > not
> > authorized to read,print,retain copy or disseminate this message or
> any
> > part
> > of it.If you have received this message in error, please notify the
> > sender
> > immediately by email.
> >
> > [Non-text portions of this message have been removed]
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> >
> > M-B Companies Confidentiality Notice:
> > This message is being sent by M-B Companies. It is intended
> exclusively for
> > the individuals and entities to which it is addressed. This
> communication,
> > including any attachments, may contain information that is
> proprietary,
> > privileged and confidential if you are not the named addressee; you
> are not
> > authorized to read,print,retain copy or disseminate this message or
> any part
> > of it.If you have received this message in error, please notify the
> sender
> > immediately by email.
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>
>
> M-B Companies Confidentiality Notice:
> This message is being sent by M-B Companies. It is intended
> the individuals and entities to which it is addressed. Thiscommunication,
> including any attachments, may contain information that isproprietary,
> privileged and confidential if you are not the named addressee; youare not
> authorized to read,print,retain copy or disseminate this message orany part
> of it.If you have received this message in error, please notify thesender
> immediately by email.M-B Companies Confidentiality Notice:
>
> [Non-text portions of this message have been removed]
>
This message is being sent by M-B Companies. It is intended exclusively for
the individuals and entities to which it is addressed. This communication,
including any attachments, may contain information that is proprietary,
privileged and confidential if you are not the named addressee; you are not
authorized to read,print,retain copy or disseminate this message or any part
of it.If you have received this message in error, please notify the sender
immediately by email.
[Non-text portions of this message have been removed]