BPM 4GL Code help

You know I thought about True, I did a quick look in the data definition
to get an idea of the field state..and I saw 'yes' in the description
box..but I was pressed for time. I just knew that you had to have that
sort of logic built in. Glad you figured it out.



Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Thomas Rose
Sent: Thursday, June 11, 2009 3:25 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] BPM 4GL Code help





You, sir, are a genius and a gentleman! Now I owe you twice - once for
putting on the WebEx last week, and once for helping me get this thing
straightened out.

BTW, I got a validation error when I used:

If OrderDtl.Commissionable='Yes' THEN DO:

The correct formulation was pretty close to that though (and I would not
have gotten there without your help):

IF OrderDtl.Commissionable=True THEN DO:

Apparently, Progress expects a logical expression from the data in that
field. I know this can be different when working with conditions in
BAQ's, but that did the trick here.

Thank you, Rob, and thank you, Nigel (I borrowed and modified some of
the code Nigel presented in the WebEx).

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com
<http://www.electricmirror.com> >

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of Rob Bucek
Sent: Thursday, June 11, 2009 12:14 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] BPM 4GL Code help

<< FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO: >>

Wouldn't you want to define that last line...

If OrderDtl.Commissionable = 'Yes' THEN DO:

Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/ <http://www.dsmfg.com/> >

(Click the logo to view our site)

________________________________

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com
<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com>]
On Behalf
Of Thomas Rose
Sent: Thursday, June 11, 2009 1:28 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com>
Subject: [Vantage] BPM 4GL Code help

Inspired by Nigel, Rob, and Charlie's BPM presentation last week, I am
tackling my first one. My objective is to update the order header table,
setting the user field, Date06 to the ship date of the most recent
commissionable shipment if the most recent commissionable shipment is
the final commissionable shipment on the order. Here is my code, which I
set up as a post processing directive in the CustShip business object,
Update method:

FIND FIRST ttShipHead no-lock no-error.
IF AVAILABLE ttShipHead THEN DO:
/*Get the corresponding ShipOrd record*/
FOR EACH ShipOrd WHERE ShipOrd.Company=ttShipHead.Company AND
ShipOrd.PackNum=ttShipHead.PackNum no-lock:
IF AVAILABLE ShipOrd THEN DO:
/*Check all the commissionable order lines to determine if they have all
been shipped*/
DEFINE VARIABLE QuantityQualified as LOGICAL.
/*Initially posit that everything on the order has shipped*/
QuantityQualified=True.
/*Cycle through each OrderDtl line*/
FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO:
FOR EACH OrderRel where OrderRel.Company = OrderDtl.Company and
OrderRel.OrderNum = OrderDtl.OrderNum and OrderRel.OrderLine =
OrderDtl.OrderLine no-lock:
IF OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty <
OrderRel.OurReqQty THEN DO:
/*Not all requested quantity has shipped - item is not yet quantity
qualified*/
QuantityQualified=False.
END.
END.
END.
END.
/*If QuantityQualified is still true then this shipment is the one that
qualified it. Record the shipment date as the shipment qualified date.*/
IF QuantityQualified=True THEN DO:
FOR EACH OrderHed WHERE OrderHed.Company = ShipOrd.Company AND
OrderHed.OrderNum = ShipOrd.OrderNum exclusive-lock:
IF AVAILABLE OrderHed THEN DO:
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE,
'Date06',ttShipHead.ShipDate).
END.
END.
END.
END.
END.
END.

Of course, since this is my first, it does not work. I'm not quite sure
why. I've got one theory. When I trace log what happens when I ship
something, I don't see the ShipOrd or any of the Order tables being
touched, though they should, right? Do I need to put the process
elsewhere? Should I do something like Nigel did for updating a range of
orders - which would only happen when I tell it to run, instead of
firing every time there is a shipment?

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com
<http://www.electricmirror.com>
<http://www.electricmirror.com <http://www.electricmirror.com> > >

Note: The information contained in the e-mail, including any
attachments, is legally privileged and confidential. If you are not the
intended recipient you are hereby notified that any reading, use or
dissemination of this message is strictly prohibited. If you have
received this message in error, please immediately notify us by
telephone at 425-776-4946 and delete this message from your system. Even
though this e-mail and any attachments are believed to be free of any
virus or other defect that might affect any computer system into which
it is received and opened, it is the responsibility of the recipient to
ensure that it is virus free, and no responsibility is accepted by
Electric Mirror LLC for any loss or damage arising in any way from its
use

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

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

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





[Non-text portions of this message have been removed]
Inspired by Nigel, Rob, and Charlie's BPM presentation last week, I am tackling my first one. My objective is to update the order header table, setting the user field, Date06 to the ship date of the most recent commissionable shipment if the most recent commissionable shipment is the final commissionable shipment on the order. Here is my code, which I set up as a post processing directive in the CustShip business object, Update method:

FIND FIRST ttShipHead no-lock no-error.
IF AVAILABLE ttShipHead THEN DO:
/*Get the corresponding ShipOrd record*/
FOR EACH ShipOrd WHERE ShipOrd.Company=ttShipHead.Company AND ShipOrd.PackNum=ttShipHead.PackNum no-lock:
IF AVAILABLE ShipOrd THEN DO:
/*Check all the commissionable order lines to determine if they have all been shipped*/
DEFINE VARIABLE QuantityQualified as LOGICAL.
/*Initially posit that everything on the order has shipped*/
QuantityQualified=True.
/*Cycle through each OrderDtl line*/
FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO:
FOR EACH OrderRel where OrderRel.Company = OrderDtl.Company and OrderRel.OrderNum = OrderDtl.OrderNum and OrderRel.OrderLine = OrderDtl.OrderLine no-lock:
IF OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty < OrderRel.OurReqQty THEN DO:
/*Not all requested quantity has shipped - item is not yet quantity qualified*/
QuantityQualified=False.
END.
END.
END.
END.
/*If QuantityQualified is still true then this shipment is the one that qualified it. Record the shipment date as the shipment qualified date.*/
IF QuantityQualified=True THEN DO:
FOR EACH OrderHed WHERE OrderHed.Company = ShipOrd.Company AND OrderHed.OrderNum = ShipOrd.OrderNum exclusive-lock:
IF AVAILABLE OrderHed THEN DO:
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE, 'Date06',ttShipHead.ShipDate).
END.
END.
END.
END.
END.
END.

Of course, since this is my first, it does not work. I'm not quite sure why. I've got one theory. When I trace log what happens when I ship something, I don't see the ShipOrd or any of the Order tables being touched, though they should, right? Do I need to put the process elsewhere? Should I do something like Nigel did for updating a range of orders - which would only happen when I tell it to run, instead of firing every time there is a shipment?

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com>

Note: The information contained in the e-mail, including any attachments, is legally privileged and confidential. If you are not the intended recipient you are hereby notified that any reading, use or dissemination of this message is strictly prohibited. If you have received this message in error, please immediately notify us by telephone at 425-776-4946 and delete this message from your system. Even though this e-mail and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free, and no responsibility is accepted by Electric Mirror LLC for any loss or damage arising in any way from its use




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



What method are you using to ship? Normal Header, line method or
Packout?



Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Thomas Rose
Sent: Thursday, June 11, 2009 1:28 PM
To: vantage@yahoogroups.com
Subject: [Vantage] BPM 4GL Code help





Inspired by Nigel, Rob, and Charlie's BPM presentation last week, I am
tackling my first one. My objective is to update the order header table,
setting the user field, Date06 to the ship date of the most recent
commissionable shipment if the most recent commissionable shipment is
the final commissionable shipment on the order. Here is my code, which I
set up as a post processing directive in the CustShip business object,
Update method:

FIND FIRST ttShipHead no-lock no-error.
IF AVAILABLE ttShipHead THEN DO:
/*Get the corresponding ShipOrd record*/
FOR EACH ShipOrd WHERE ShipOrd.Company=ttShipHead.Company AND
ShipOrd.PackNum=ttShipHead.PackNum no-lock:
IF AVAILABLE ShipOrd THEN DO:
/*Check all the commissionable order lines to determine if they have all
been shipped*/
DEFINE VARIABLE QuantityQualified as LOGICAL.
/*Initially posit that everything on the order has shipped*/
QuantityQualified=True.
/*Cycle through each OrderDtl line*/
FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO:
FOR EACH OrderRel where OrderRel.Company = OrderDtl.Company and
OrderRel.OrderNum = OrderDtl.OrderNum and OrderRel.OrderLine =
OrderDtl.OrderLine no-lock:
IF OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty <
OrderRel.OurReqQty THEN DO:
/*Not all requested quantity has shipped - item is not yet quantity
qualified*/
QuantityQualified=False.
END.
END.
END.
END.
/*If QuantityQualified is still true then this shipment is the one that
qualified it. Record the shipment date as the shipment qualified date.*/
IF QuantityQualified=True THEN DO:
FOR EACH OrderHed WHERE OrderHed.Company = ShipOrd.Company AND
OrderHed.OrderNum = ShipOrd.OrderNum exclusive-lock:
IF AVAILABLE OrderHed THEN DO:
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE,
'Date06',ttShipHead.ShipDate).
END.
END.
END.
END.
END.
END.

Of course, since this is my first, it does not work. I'm not quite sure
why. I've got one theory. When I trace log what happens when I ship
something, I don't see the ShipOrd or any of the Order tables being
touched, though they should, right? Do I need to put the process
elsewhere? Should I do something like Nigel did for updating a range of
orders - which would only happen when I tell it to run, instead of
firing every time there is a shipment?

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com
<http://www.electricmirror.com> >

Note: The information contained in the e-mail, including any
attachments, is legally privileged and confidential. If you are not the
intended recipient you are hereby notified that any reading, use or
dissemination of this message is strictly prohibited. If you have
received this message in error, please immediately notify us by
telephone at 425-776-4946 and delete this message from your system. Even
though this e-mail and any attachments are believed to be free of any
virus or other defect that might affect any computer system into which
it is received and opened, it is the responsibility of the recipient to
ensure that it is virus free, and no responsibility is accepted by
Electric Mirror LLC for any loss or damage arising in any way from its
use

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





[Non-text portions of this message have been removed]
<< FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO: >>



Wouldn't you want to define that last line...

If OrderDtl.Commissionable = 'Yes' THEN DO:



Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)



________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Thomas Rose
Sent: Thursday, June 11, 2009 1:28 PM
To: vantage@yahoogroups.com
Subject: [Vantage] BPM 4GL Code help





Inspired by Nigel, Rob, and Charlie's BPM presentation last week, I am
tackling my first one. My objective is to update the order header table,
setting the user field, Date06 to the ship date of the most recent
commissionable shipment if the most recent commissionable shipment is
the final commissionable shipment on the order. Here is my code, which I
set up as a post processing directive in the CustShip business object,
Update method:

FIND FIRST ttShipHead no-lock no-error.
IF AVAILABLE ttShipHead THEN DO:
/*Get the corresponding ShipOrd record*/
FOR EACH ShipOrd WHERE ShipOrd.Company=ttShipHead.Company AND
ShipOrd.PackNum=ttShipHead.PackNum no-lock:
IF AVAILABLE ShipOrd THEN DO:
/*Check all the commissionable order lines to determine if they have all
been shipped*/
DEFINE VARIABLE QuantityQualified as LOGICAL.
/*Initially posit that everything on the order has shipped*/
QuantityQualified=True.
/*Cycle through each OrderDtl line*/
FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO:
FOR EACH OrderRel where OrderRel.Company = OrderDtl.Company and
OrderRel.OrderNum = OrderDtl.OrderNum and OrderRel.OrderLine =
OrderDtl.OrderLine no-lock:
IF OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty <
OrderRel.OurReqQty THEN DO:
/*Not all requested quantity has shipped - item is not yet quantity
qualified*/
QuantityQualified=False.
END.
END.
END.
END.
/*If QuantityQualified is still true then this shipment is the one that
qualified it. Record the shipment date as the shipment qualified date.*/
IF QuantityQualified=True THEN DO:
FOR EACH OrderHed WHERE OrderHed.Company = ShipOrd.Company AND
OrderHed.OrderNum = ShipOrd.OrderNum exclusive-lock:
IF AVAILABLE OrderHed THEN DO:
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE,
'Date06',ttShipHead.ShipDate).
END.
END.
END.
END.
END.
END.

Of course, since this is my first, it does not work. I'm not quite sure
why. I've got one theory. When I trace log what happens when I ship
something, I don't see the ShipOrd or any of the Order tables being
touched, though they should, right? Do I need to put the process
elsewhere? Should I do something like Nigel did for updating a range of
orders - which would only happen when I tell it to run, instead of
firing every time there is a shipment?

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com
<http://www.electricmirror.com> >

Note: The information contained in the e-mail, including any
attachments, is legally privileged and confidential. If you are not the
intended recipient you are hereby notified that any reading, use or
dissemination of this message is strictly prohibited. If you have
received this message in error, please immediately notify us by
telephone at 425-776-4946 and delete this message from your system. Even
though this e-mail and any attachments are believed to be free of any
virus or other defect that might affect any computer system into which
it is received and opened, it is the responsibility of the recipient to
ensure that it is virus free, and no responsibility is accepted by
Electric Mirror LLC for any loss or damage arising in any way from its
use

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





[Non-text portions of this message have been removed]
You, sir, are a genius and a gentleman! Now I owe you twice - once for putting on the WebEx last week, and once for helping me get this thing straightened out.

BTW, I got a validation error when I used:

If OrderDtl.Commissionable='Yes' THEN DO:

The correct formulation was pretty close to that though (and I would not have gotten there without your help):

IF OrderDtl.Commissionable=True THEN DO:

Apparently, Progress expects a logical expression from the data in that field. I know this can be different when working with conditions in BAQ's, but that did the trick here.

Thank you, Rob, and thank you, Nigel (I borrowed and modified some of the code Nigel presented in the WebEx).

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com>


From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
Sent: Thursday, June 11, 2009 12:14 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] BPM 4GL Code help





<< FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO: >>

Wouldn't you want to define that last line...

If OrderDtl.Commissionable = 'Yes' THEN DO:

Rob Bucek

Manufacturing Engineer

PH: 715-284-5376 ext 311

FAX: 715-284-4084

<http://www.dsmfg.com/>

(Click the logo to view our site)

________________________________

From: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>] On Behalf
Of Thomas Rose
Sent: Thursday, June 11, 2009 1:28 PM
To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>
Subject: [Vantage] BPM 4GL Code help

Inspired by Nigel, Rob, and Charlie's BPM presentation last week, I am
tackling my first one. My objective is to update the order header table,
setting the user field, Date06 to the ship date of the most recent
commissionable shipment if the most recent commissionable shipment is
the final commissionable shipment on the order. Here is my code, which I
set up as a post processing directive in the CustShip business object,
Update method:

FIND FIRST ttShipHead no-lock no-error.
IF AVAILABLE ttShipHead THEN DO:
/*Get the corresponding ShipOrd record*/
FOR EACH ShipOrd WHERE ShipOrd.Company=ttShipHead.Company AND
ShipOrd.PackNum=ttShipHead.PackNum no-lock:
IF AVAILABLE ShipOrd THEN DO:
/*Check all the commissionable order lines to determine if they have all
been shipped*/
DEFINE VARIABLE QuantityQualified as LOGICAL.
/*Initially posit that everything on the order has shipped*/
QuantityQualified=True.
/*Cycle through each OrderDtl line*/
FOR EACH OrderDtl WHERE OrderDtl.Company = ShipOrd.Company AND
OrderDtl.OrderNum = ShipOrd.OrderNum no-lock:
/*Only consider commissionable lines*/
IF OrderDtl.Commissionable THEN DO:
FOR EACH OrderRel where OrderRel.Company = OrderDtl.Company and
OrderRel.OrderNum = OrderDtl.OrderNum and OrderRel.OrderLine =
OrderDtl.OrderLine no-lock:
IF OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty <
OrderRel.OurReqQty THEN DO:
/*Not all requested quantity has shipped - item is not yet quantity
qualified*/
QuantityQualified=False.
END.
END.
END.
END.
/*If QuantityQualified is still true then this shipment is the one that
qualified it. Record the shipment date as the shipment qualified date.*/
IF QuantityQualified=True THEN DO:
FOR EACH OrderHed WHERE OrderHed.Company = ShipOrd.Company AND
OrderHed.OrderNum = ShipOrd.OrderNum exclusive-lock:
IF AVAILABLE OrderHed THEN DO:
RUN lib\UpdateTableBuffer.p(input BUFFER OrderHed:HANDLE,
'Date06',ttShipHead.ShipDate).
END.
END.
END.
END.
END.
END.

Of course, since this is my first, it does not work. I'm not quite sure
why. I've got one theory. When I trace log what happens when I ship
something, I don't see the ShipOrd or any of the Order tables being
touched, though they should, right? Do I need to put the process
elsewhere? Should I do something like Nigel did for updating a range of
orders - which would only happen when I tell it to run, instead of
firing every time there is a shipment?

Thom Rose
Controller
Electric Mirror LLC
HOTEL LUXURY

"The World Leader in Back-lit Mirrors & Mirror TV Technology"

T 425 776-4946
A 11831 Beverly Park Rd, Bldg D, Everett, WA 98204 USA
www.electricmirror.com<http://www.electricmirror.com
<http://www.electricmirror.com> >

Note: The information contained in the e-mail, including any
attachments, is legally privileged and confidential. If you are not the
intended recipient you are hereby notified that any reading, use or
dissemination of this message is strictly prohibited. If you have
received this message in error, please immediately notify us by
telephone at 425-776-4946 and delete this message from your system. Even
though this e-mail and any attachments are believed to be free of any
virus or other defect that might affect any computer system into which
it is received and opened, it is the responsibility of the recipient to
ensure that it is virus free, and no responsibility is accepted by
Electric Mirror LLC for any loss or damage arising in any way from its
use

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

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



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