Help with BAM

Aaron, the manuals are rather weighty, thanks for your example code, it
works perfectly and taught me more than FOR EACH - END

John

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Aaron Hoyt
Sent: Tuesday, 14 March 2006 12:23 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM

John,
I did the manuals routine. Found it to be to little benefit for the time.
Spent my time with Progress Help and it's examples. Some things (as with
the manual) won't apply because of the limits of the BAM, but it surprising
how far Help and some educated guesses can get you. :)
Good luck,
Aaron Hoyt
Vantage Plastics

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]On Behalf
Of John Walter
Sent: Thursday, March 09, 2006 5:43 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM


Thanks Aaron, I will test this later today and let you know. I think its
time we (Hufcor) downloaded some Progress Manuals and got seriious about BAM

John
Hi all,

A challenge for the BAM experts out there. I have written a BAM .p program
to send an email to our Service Division people when an invoice is created
for our main products. It works fine when the invoice only has one line but
falls over if there is more than one line. I think the problem is my outer
join to the ShipTo table but nan't see a way around it. See code below, any
suggestions welcome


{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE Plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE Project AS CHARACTER NO-UNDO.

FIND Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company = Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.InvcDtl THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.Customer THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.ShipTo OUTER-JOIN NO-LOCK Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-ERROR.
IF NOT AVAILABLE Mfgsys.ShipTo THEN DO:
RETURN "Cancel Send".
END.

Plant = Mfgsys.InvcHead.Plant.
Project = Mfgsys.InvcHead.InvoiceComment.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + Project + ". Refer Sales Order " +
string(InvcDtl.OrderNum) + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

CASE Plant:

WHEN "QLD" THEN
Email-CC = "serviceqld@...".
WHEN "NSW" THEN
Email-CC = "servicensw@...".

END CASE.

END.



John Walter | National IS Advisor | Hufcor Pty Ltd

5-7 Trade Park Drive, Tullamarine, Victoria. 3250

Phone +613 9330 3733 | Fax +613 9338 9015

www.hufcor.com.au <http://www.hufcor.com.au/>
Hi,

Do your invoices contain multiple lines where some of the lines you
don't want to alert on? I am not too hot on this stuff but isn't
there a command like find first? You might not need the outer then
depending on the above.

As I say , I am not too good on this front.




--- In vantage@yahoogroups.com, "John Walter" <john.w@...> wrote:
>
> Hi all,
>
> A challenge for the BAM experts out there. I have written a BAM .p
program
> to send an email to our Service Division people when an invoice is
created
> for our main products. It works fine when the invoice only has one
line but
> falls over if there is more than one line. I think the problem is
my outer
> join to the ShipTo table but nan't see a way around it. See code
below, any
> suggestions welcome
>
>
> {ud/GlbAlert.i &TableName = "InvcHead"}
>
> DEFINE VARIABLE Plant AS CHARACTER NO-UNDO.
> DEFINE VARIABLE Project AS CHARACTER NO-UNDO.
>
> FIND Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company =
Mfgsys.InvcHead.Company)
> AND
> (Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK
NO-ERROR.
> IF NOT AVAILABLE Mfgsys.InvcDtl THEN DO:
> RETURN "Cancel Send".
> END.
>
> FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
> Mfgsys.InvcHead.Company) AND
> (Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK NO-
ERROR.
> IF NOT AVAILABLE Mfgsys.Customer THEN DO:
> RETURN "Cancel Send".
> END.
>
> FIND Mfgsys.ShipTo OUTER-JOIN NO-LOCK Where (Mfgsys.ShipTo.Company
=
> Mfgsys.InvcDtl.Company) AND
> (Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
> (Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-ERROR.
> IF NOT AVAILABLE Mfgsys.ShipTo THEN DO:
> RETURN "Cancel Send".
> END.
>
> Plant = Mfgsys.InvcHead.Plant.
> Project = Mfgsys.InvcHead.InvoiceComment.
>
> IF Mfgsys.InvcHead.Posted = No THEN DO:
> RETURN "Cancel Send":U.
> END.
>
> IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
> RETURN "Cancel Send":U.
> END.
>
> IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
> RETURN "Cancel Send":U.
> END.
>
> IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
> RETURN "Cancel Send":U.
> END.
>
> ELSE DO:
>
> ASSIGN Email-Subject = "New Service Opportunity".
>
> ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum)
+ " has
> just been raised for " + Project + ". Refer Sales Order " +
> string(InvcDtl.OrderNum) + "~n~n"
>
> + "Customer is " + Customer.Name + "~n"
> + "Ship To Address1 - " + ShipTo.Address1 + "~n"
> + "Ship To Address2 - " + ShipTo.Address2 + "~n"
> + "Ship To Address3 - " + ShipTo.Address3 + "~n"
> + "City/State - " + ShipTo.City + " " + ShipTo.State.
>
> CASE Plant:
>
> WHEN "BBK" THEN
> Email-To = "aaa@...".
> WHEN "QLD" THEN
> Email-To = "bbb@...".
> WHEN "SA" THEN
> Email-To = "ccc@...".
> WHEN "GLASS" THEN
> Email-To = david.l@...
> WHEN "WA" THEN
> Email-To = "ddd@...".
> WHEN "NSW" THEN
> Email-To = "eee@...".
> WHEN "VSO" THEN
> Email-To = "fff@...".
>
> END CASE.
>
> CASE Plant:
>
> WHEN "QLD" THEN
> Email-CC = "serviceqld@...".
> WHEN "NSW" THEN
> Email-CC = "servicensw@...".
>
> END CASE.
>
> END.
>
>
>
> John Walter | National IS Advisor | Hufcor Pty Ltd
>
> 5-7 Trade Park Drive, Tullamarine, Victoria. 3250
>
> Phone +613 9330 3733 | Fax +613 9338 9015
>
> www.hufcor.com.au <http://www.hufcor.com.au/>
>
John,
In the first Find InvcDtl, wouldn't you want to set up a FOR EACH loop to
evaluate each of the detail lines?
I think I would do it with a numeric variable initialized to 0 and have it
add one for each detail line it finds and evaluates. Later, test the value
of the variable and if it's 0, cancel, if not, process the rest of the rules
for sending the email.
Just my thoughts, take it with a grain of salt.
Aaron Hoyt
Vantage Plastics

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]On Behalf
Of John Walter
Sent: Wednesday, March 08, 2006 6:57 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Help with BAM


Hi all,

A challenge for the BAM experts out there. I have written a BAM .p program
to send an email to our Service Division people when an invoice is created
for our main products. It works fine when the invoice only has one line but
falls over if there is more than one line. I think the problem is my outer
join to the ShipTo table but nan't see a way around it. See code below, any
suggestions welcome


{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE Plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE Project AS CHARACTER NO-UNDO.

FIND Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company = Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.InvcDtl THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.Customer THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.ShipTo OUTER-JOIN NO-LOCK Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-ERROR.
IF NOT AVAILABLE Mfgsys.ShipTo THEN DO:
RETURN "Cancel Send".
END.

Plant = Mfgsys.InvcHead.Plant.
Project = Mfgsys.InvcHead.InvoiceComment.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + Project + ". Refer Sales Order " +
string(InvcDtl.OrderNum) + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

CASE Plant:

WHEN "QLD" THEN
Email-CC = "serviceqld@...".
WHEN "NSW" THEN
Email-CC = "servicensw@...".

END CASE.

END.



John Walter | National IS Advisor | Hufcor Pty Ltd

5-7 Trade Park Drive, Tullamarine, Victoria. 3250

Phone +613 9330 3733 | Fax +613 9338 9015

www.hufcor.com.au <http://www.hufcor.com.au/>




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links
Thanks Aaron, do you have an example of the syntax for this, I am new to BAM
and what I have written below is my most complex BAM to date and involved
much blood, sweat and tears to get it to this point.


John

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Aaron Hoyt
Sent: Friday, 10 March 2006 1:36 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM

John,
In the first Find InvcDtl, wouldn't you want to set up a FOR EACH loop to
evaluate each of the detail lines?
I think I would do it with a numeric variable initialized to 0 and have it
add one for each detail line it finds and evaluates. Later, test the value
of the variable and if it's 0, cancel, if not, process the rest of the rules
for sending the email.
Just my thoughts, take it with a grain of salt.
Aaron Hoyt
Vantage Plastics

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]On Behalf
Of John Walter
Sent: Wednesday, March 08, 2006 6:57 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Help with BAM


Hi all,

A challenge for the BAM experts out there. I have written a BAM .p program
to send an email to our Service Division people when an invoice is created
for our main products. It works fine when the invoice only has one line but
falls over if there is more than one line. I think the problem is my outer
join to the ShipTo table but nan't see a way around it. See code below, any
suggestions welcome


{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE Plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE Project AS CHARACTER NO-UNDO.

FIND Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company = Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.InvcDtl THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.Customer THEN DO:
RETURN "Cancel Send".
END.

FIND Mfgsys.ShipTo OUTER-JOIN NO-LOCK Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-ERROR.
IF NOT AVAILABLE Mfgsys.ShipTo THEN DO:
RETURN "Cancel Send".
END.

Plant = Mfgsys.InvcHead.Plant.
Project = Mfgsys.InvcHead.InvoiceComment.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + Project + ". Refer Sales Order " +
string(InvcDtl.OrderNum) + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

CASE Plant:

WHEN "QLD" THEN
Email-CC = "serviceqld@...".
WHEN "NSW" THEN
Email-CC = "servicensw@...".

END CASE.

END.



John Walter | National IS Advisor | Hufcor Pty Ltd

5-7 Trade Park Drive, Tullamarine, Victoria. 3250

Phone +613 9330 3733 | Fax +613 9338 9015

www.hufcor.com.au <http://www.hufcor.com.au/>




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links









Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links
No, I am looking to report on the basis that an invoice was created,
regardless of the number of lines so your suggestion might work

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
brychanwilliams
Sent: Thursday, 9 March 2006 7:43 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Help with BAM

Hi,

Do your invoices contain multiple lines where some of the lines you
don't want to alert on? I am not too hot on this stuff but isn't
there a command like find first? You might not need the outer then
depending on the above.

As I say , I am not too good on this front.
Ok, I am sure I missed something, but...
Below is a direct modification of your code more the way I would approach.
This doesn't have my "style" to it because of the direct modification, but I
think the flow will work.
If nothing else it should give you an idea on using FOR EACH...END
statements.
Good luck
Aaron Hoyt
Vantage Plastics

{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE project AS CHARACTER NO-UNDO.
DEFINE VARIABLE ordr AS CHARACTER INITIAL "" NO-UNDO.
DEFINE VARIABLE num AS INTEGER INITIAL 0 NO-UNDO.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK.

plant = Mfgsys.InvcHead.Plant.
project = Mfgsys.InvcHead.InvoiceComment.

FOR EACH Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company =
Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK.

num = num + 1.

FIND Mfgsys.ShipTo Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-LOCK.

IF ordr = ""
THEN DO:
ordr = ordr + string(InvcDtl.OrderNum).
END.
ELSE DO:
ordr = ordr + ", " + string(InvcDtl.OrderNum).
END.


END.

IF num = 0 THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + project + ". Refer Sales Order(s) " +
ordr + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
Email-CC = "serviceqld@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
Email-CC = "servicensw@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

END.
Thanks Aaron, I will test this later today and let you know. I think its
time we (Hufcor) downloaded some Progress Manuals and got seriious about BAM

John

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Aaron Hoyt
Sent: Friday, 10 March 2006 8:54 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM

Ok, I am sure I missed something, but...
Below is a direct modification of your code more the way I would approach.
This doesn't have my "style" to it because of the direct modification, but I
think the flow will work.
If nothing else it should give you an idea on using FOR EACH...END
statements.
Good luck
Aaron Hoyt
Vantage Plastics

{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE project AS CHARACTER NO-UNDO.
DEFINE VARIABLE ordr AS CHARACTER INITIAL "" NO-UNDO.
DEFINE VARIABLE num AS INTEGER INITIAL 0 NO-UNDO.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK.

plant = Mfgsys.InvcHead.Plant.
project = Mfgsys.InvcHead.InvoiceComment.

FOR EACH Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company =
Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK.

num = num + 1.

FIND Mfgsys.ShipTo Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-LOCK.

IF ordr = ""
THEN DO:
ordr = ordr + string(InvcDtl.OrderNum).
END.
ELSE DO:
ordr = ordr + ", " + string(InvcDtl.OrderNum).
END.


END.

IF num = 0 THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + project + ". Refer Sales Order(s) " +
ordr + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
Email-CC = "serviceqld@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
Email-CC = "servicensw@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

END.




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links
John,
I did the manuals routine. Found it to be to little benefit for the time.
Spent my time with Progress Help and it's examples. Some things (as with
the manual) won't apply because of the limits of the BAM, but it surprising
how far Help and some educated guesses can get you. :)
Good luck,
Aaron Hoyt
Vantage Plastics

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]On Behalf
Of John Walter
Sent: Thursday, March 09, 2006 5:43 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM


Thanks Aaron, I will test this later today and let you know. I think its
time we (Hufcor) downloaded some Progress Manuals and got seriious about BAM

John

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Aaron Hoyt
Sent: Friday, 10 March 2006 8:54 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM

Ok, I am sure I missed something, but...
Below is a direct modification of your code more the way I would approach.
This doesn't have my "style" to it because of the direct modification, but I
think the flow will work.
If nothing else it should give you an idea on using FOR EACH...END
statements.
Good luck
Aaron Hoyt
Vantage Plastics

{ud/GlbAlert.i &TableName = "InvcHead"}

DEFINE VARIABLE plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE project AS CHARACTER NO-UNDO.
DEFINE VARIABLE ordr AS CHARACTER INITIAL "" NO-UNDO.
DEFINE VARIABLE num AS INTEGER INITIAL 0 NO-UNDO.

FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK.

plant = Mfgsys.InvcHead.Plant.
project = Mfgsys.InvcHead.InvoiceComment.

FOR EACH Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company =
Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK.

num = num + 1.

FIND Mfgsys.ShipTo Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-LOCK.

IF ordr = ""
THEN DO:
ordr = ordr + string(InvcDtl.OrderNum).
END.
ELSE DO:
ordr = ordr + ", " + string(InvcDtl.OrderNum).
END.


END.

IF num = 0 THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.

IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.

ELSE DO:

ASSIGN Email-Subject = "New Service Opportunity".

ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + project + ". Refer Sales Order(s) " +
ordr + "~n~n"

+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.

CASE Plant:

WHEN "BBK" THEN
Email-To = "aaa@...".
WHEN "QLD" THEN
Email-To = "bbb@...".
Email-CC = "serviceqld@...".
WHEN "SA" THEN
Email-To = "ccc@...".
WHEN "GLASS" THEN
Email-To = david.l@....
WHEN "WA" THEN
Email-To = "ddd@...".
WHEN "NSW" THEN
Email-To = "eee@...".
Email-CC = "servicensw@...".
WHEN "VSO" THEN
Email-To = "fff@...".

END CASE.

END.




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links







Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Yahoo! Groups Links