Updatable BAQ BPM

Thanks John & Jose!

John,
Easy as pie, easiest ABL I've ever messed with!
And thanks for the explanation and alternate code, I think I will try that since some cases I found we are updating 100+ OrderRel records and that seems to take awhile (respectively).
Either way, it works and I learned something new about FOR EACH!
Do you do ABL programming training?

-Rick Bird
IT Software Administrator
Rowmark, LLC.

--- In vantage@yahoogroups.com, John Driggers <waffqle@...> wrote:
>
> Jose is correct, UpdateTableBuffer is just a way to get around the fact
> that Epicor didn't allow DB writes in version 8.
>
> As far as 'find first', 'if avail' etc, that's just a different way to
> search. If you just need one record, you can do
> FIND FIRST Table WHERE X = Y.
> The 'IF Avail' is just used so the code doesn't try to execute against an
> empty result set. If you use the FOR EACH syntax, it handles that
> automatically. It fetches all the records that match and loops through
> them. If it doesn't return anything, it doesn't loop. There are situations
> where the 'FIND FIRST' method is the only way to go, but you'll know one
> when you come across it. Generally it's preferable to use the 'FOR EACH'
> syntax anytime you can get away with it. If nothing else, it's less wordy
> and easier to read.
>
> Generally you want to check the RowMod so you can find rows in the TT
> tables that were updated or appended. It's pretty common when updating
> order lines or something similar that you only want to edit the line being
> modified. RowMod lets you find that row without jumping through a lot of
> hoops.
>
> It's good habit to use rowmod lest you accidentally update the wrong
> record; though in this particular case you may not really need it. You want
> to find and update all the releases for the orderheader --assuming I'm
> following you correctly. If the only thing people are editing is the ship
> date, you can safely fire it everytime as the BPM wouldn't be called if it
> hadn't been changed. If you want to be a bit more slick and save a little
> work for you DB you could do the following:
>
> FOR EACH ttOrderHed WHERE ttOrderHed.RowMod <> '',
> EACH OrderRel WHERE OrderRel.Company = ttOrderHed.Company AND
> OrderRel.OrderNum = ttOrderHed.OrderNum AND OrderRel.ShipDate <>
> ttOrderHed.ShipDate:
> /* Do you assignments and whatnot here */
> END.
>
> That will only run against releases with shipdates that don't match the
> order header. Double check the field names, I'm going off the top of my
> head.
>
>
> *John Driggers*
> **
> *Chief Data Wrangler*
> *
> *
> *I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
> *
> *:: 904.404.9233
> :: waffqle@...
> :: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
>
> *
>
> *
>
>
>
> On Wed, Aug 8, 2012 at 2:53 PM, Jose Gomez <jose@...> wrote:
>
> > If you are in version 9X you don't need to use UpdateTbalebuffer
> >
> > *Jose C Gomez*
> > *Software Engineer*
> > *
> > *
> > *
> > *T: 904.469.1524 mobile
> > E: jose@...
> > http://www.josecgomez.com
> > <http://www.linkedin.com/in/josecgomez> <
> > http://www.facebook.com/josegomez>
> > <http://www.google.com/profiles/jose.gomez> <
> > http://www.twitter.com/joc85>
> > <http://www.josecgomez.com/professional-resume/>
> > <http://www.josecgomez.com/feed/>
> > <http://www.usdoingstuff.com>
> >
> > *Quis custodiet ipsos custodes?*
> >
> >
> >
> > On Wed, Aug 8, 2012 at 2:35 PM, that_guyy <rbird@...> wrote:
> >
> > > **
> > >
> > >
> > > JOhn,
> > > Thanks for the code & validation. I've been reading about the
> > > recommendation to use the 'Run lib\UpdateTableBuffer.p()' instead, is
> > there
> > > a way to do that instead? Is this a 'safer' way... or with what I am
> > trying
> > > to do (for each) does this just get messy.
> > >
> > > I am assuming your bit of code is more or less a sample, I still need to
> > > do all the RowMod value checks and the 'find OrderRel where' and 'if
> > avail'
> > > stuff, right?
> > >
> > > Sorry, I know just enough ABL to be dangerous.
> > >
> > > Thanks,
> > >
> > >
> > > -Rick Bird
> > > IT Software Administrator
> > > Rowmark, LLC.
> > >
> > > --- In vantage@yahoogroups.com, John Driggers <waffqle@> wrote:
> > > >
> > > > You're correct, you should be able to basically do:
> > > >
> > > > FOR EACH ttOrderHed,
> > > > EACH OrderRel WHERE OrderRel.OrderNum = ttOrderHed.OrderNum:
> > > > ASSIGN OrderRel.Field = Value.
> > > > END.
> > > >
> > > > Adjust your where clause appropriately, but that should do it.
> > > >
> > > > *John Driggers*
> > > > **
> > > > *Chief Data Wrangler*
> > > > *
> > > > *
> > > > *I have an Epicor blog <http://usdoingstuff.com/>. How useful is
> > that?*
> > > > *
> > > > *:: 904.404.9233
> > > > :: waffqle@
> > >
> > > > :: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
> > > >
> > > > *
> > > >
> > > > *
> > > >
> > > >
> > > >
> > > > On Wed, Aug 8, 2012 at 12:14 PM, that_guyy <rbird@> wrote:
> > > >
> > > > > **
> > > > >
> > > > >
> > > > > I have an updatable dashboard that displays a list from OrderHed of
> > > Orders
> > > > > on Hold and no ship by date specified. Both fields are updatable. The
> > > idea
> > > > > was that our Customer Service could quickly set the shipby date and
> > > take
> > > > > the order off hold, which works except, since it's an updatable BAQ
> > BPM
> > > > > that does the update and not base, the Sales Order releases are not
> > > getting
> > > > > their ship by date updated (like it does in Order Entry).
> > > > > What I think I can do is add to the ABL code on the Updatable BAQ BPM
> > > to
> > > > > update all the releases for that sales order to match the new ship
> > > date.
> > > > >
> > > > > Other than 'reading' a value from a table, I have never tried to
> > update
> > > > > data to a table directly, I have always used what ever tt fields that
> > > were
> > > > > available to me in the BPM, in this case the OrderRel is not
> > available
> > > to
> > > > > me, how do I 'get it'?
> > > > >
> > > > > Then I was thinking I could use a 'for each...' type of query or
> > > whatever
> > > > > to loop through all the OrderRel records and update the date.
> > > > >
> > > > > Any help on this would be most appreciated!
> > > > >
> > > > > -Rick Bird
> > > > > IT Software Administrator
> > > > > Rowmark, LLC.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > 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/linksYahoo! Groups Links
> >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
I have an updatable dashboard that displays a list from OrderHed of Orders on Hold and no ship by date specified. Both fields are updatable. The idea was that our Customer Service could quickly set the shipby date and take the order off hold, which works except, since it's an updatable BAQ BPM that does the update and not base, the Sales Order releases are not getting their ship by date updated (like it does in Order Entry).
What I think I can do is add to the ABL code on the Updatable BAQ BPM to update all the releases for that sales order to match the new ship date.

Other than 'reading' a value from a table, I have never tried to update data to a table directly, I have always used what ever tt fields that were available to me in the BPM, in this case the OrderRel is not available to me, how do I 'get it'?

Then I was thinking I could use a 'for each...' type of query or whatever to loop through all the OrderRel records and update the date.

Any help on this would be most appreciated!

-Rick Bird
IT Software Administrator
Rowmark, LLC.
You're correct, you should be able to basically do:

FOR EACH ttOrderHed,
EACH OrderRel WHERE OrderRel.OrderNum = ttOrderHed.OrderNum:
ASSIGN OrderRel.Field = Value.
END.

Adjust your where clause appropriately, but that should do it.

*John Driggers*
**
*Chief Data Wrangler*
*
*
*I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
*
*:: 904.404.9233
:: waffqle@...
:: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>

*

*



On Wed, Aug 8, 2012 at 12:14 PM, that_guyy <rbird@...> wrote:

> **
>
>
> I have an updatable dashboard that displays a list from OrderHed of Orders
> on Hold and no ship by date specified. Both fields are updatable. The idea
> was that our Customer Service could quickly set the shipby date and take
> the order off hold, which works except, since it's an updatable BAQ BPM
> that does the update and not base, the Sales Order releases are not getting
> their ship by date updated (like it does in Order Entry).
> What I think I can do is add to the ABL code on the Updatable BAQ BPM to
> update all the releases for that sales order to match the new ship date.
>
> Other than 'reading' a value from a table, I have never tried to update
> data to a table directly, I have always used what ever tt fields that were
> available to me in the BPM, in this case the OrderRel is not available to
> me, how do I 'get it'?
>
> Then I was thinking I could use a 'for each...' type of query or whatever
> to loop through all the OrderRel records and update the date.
>
> Any help on this would be most appreciated!
>
> -Rick Bird
> IT Software Administrator
> Rowmark, LLC.
>
>
>


[Non-text portions of this message have been removed]
JOhn,
Thanks for the code & validation. I've been reading about the recommendation to use the 'Run lib\UpdateTableBuffer.p()' instead, is there a way to do that instead? Is this a 'safer' way... or with what I am trying to do (for each) does this just get messy.

I am assuming your bit of code is more or less a sample, I still need to do all the RowMod value checks and the 'find OrderRel where' and 'if avail' stuff, right?

Sorry, I know just enough ABL to be dangerous.

Thanks,

-Rick Bird
IT Software Administrator
Rowmark, LLC.

--- In vantage@yahoogroups.com, John Driggers <waffqle@...> wrote:
>
> You're correct, you should be able to basically do:
>
> FOR EACH ttOrderHed,
> EACH OrderRel WHERE OrderRel.OrderNum = ttOrderHed.OrderNum:
> ASSIGN OrderRel.Field = Value.
> END.
>
> Adjust your where clause appropriately, but that should do it.
>
> *John Driggers*
> **
> *Chief Data Wrangler*
> *
> *
> *I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
> *
> *:: 904.404.9233
> :: waffqle@...
> :: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
>
> *
>
> *
>
>
>
> On Wed, Aug 8, 2012 at 12:14 PM, that_guyy <rbird@...> wrote:
>
> > **
> >
> >
> > I have an updatable dashboard that displays a list from OrderHed of Orders
> > on Hold and no ship by date specified. Both fields are updatable. The idea
> > was that our Customer Service could quickly set the shipby date and take
> > the order off hold, which works except, since it's an updatable BAQ BPM
> > that does the update and not base, the Sales Order releases are not getting
> > their ship by date updated (like it does in Order Entry).
> > What I think I can do is add to the ABL code on the Updatable BAQ BPM to
> > update all the releases for that sales order to match the new ship date.
> >
> > Other than 'reading' a value from a table, I have never tried to update
> > data to a table directly, I have always used what ever tt fields that were
> > available to me in the BPM, in this case the OrderRel is not available to
> > me, how do I 'get it'?
> >
> > Then I was thinking I could use a 'for each...' type of query or whatever
> > to loop through all the OrderRel records and update the date.
> >
> > Any help on this would be most appreciated!
> >
> > -Rick Bird
> > IT Software Administrator
> > Rowmark, LLC.
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
If you are in version 9X you don't need to use UpdateTbalebuffer

*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*



On Wed, Aug 8, 2012 at 2:35 PM, that_guyy <rbird@...> wrote:

> **
>
>
> JOhn,
> Thanks for the code & validation. I've been reading about the
> recommendation to use the 'Run lib\UpdateTableBuffer.p()' instead, is there
> a way to do that instead? Is this a 'safer' way... or with what I am trying
> to do (for each) does this just get messy.
>
> I am assuming your bit of code is more or less a sample, I still need to
> do all the RowMod value checks and the 'find OrderRel where' and 'if avail'
> stuff, right?
>
> Sorry, I know just enough ABL to be dangerous.
>
> Thanks,
>
>
> -Rick Bird
> IT Software Administrator
> Rowmark, LLC.
>
> --- In vantage@yahoogroups.com, John Driggers <waffqle@...> wrote:
> >
> > You're correct, you should be able to basically do:
> >
> > FOR EACH ttOrderHed,
> > EACH OrderRel WHERE OrderRel.OrderNum = ttOrderHed.OrderNum:
> > ASSIGN OrderRel.Field = Value.
> > END.
> >
> > Adjust your where clause appropriately, but that should do it.
> >
> > *John Driggers*
> > **
> > *Chief Data Wrangler*
> > *
> > *
> > *I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
> > *
> > *:: 904.404.9233
> > :: waffqle@...
>
> > :: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
> >
> > *
> >
> > *
> >
> >
> >
> > On Wed, Aug 8, 2012 at 12:14 PM, that_guyy <rbird@...> wrote:
> >
> > > **
> > >
> > >
> > > I have an updatable dashboard that displays a list from OrderHed of
> Orders
> > > on Hold and no ship by date specified. Both fields are updatable. The
> idea
> > > was that our Customer Service could quickly set the shipby date and
> take
> > > the order off hold, which works except, since it's an updatable BAQ BPM
> > > that does the update and not base, the Sales Order releases are not
> getting
> > > their ship by date updated (like it does in Order Entry).
> > > What I think I can do is add to the ABL code on the Updatable BAQ BPM
> to
> > > update all the releases for that sales order to match the new ship
> date.
> > >
> > > Other than 'reading' a value from a table, I have never tried to update
> > > data to a table directly, I have always used what ever tt fields that
> were
> > > available to me in the BPM, in this case the OrderRel is not available
> to
> > > me, how do I 'get it'?
> > >
> > > Then I was thinking I could use a 'for each...' type of query or
> whatever
> > > to loop through all the OrderRel records and update the date.
> > >
> > > Any help on this would be most appreciated!
> > >
> > > -Rick Bird
> > > IT Software Administrator
> > > Rowmark, LLC.
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>


[Non-text portions of this message have been removed]
Jose is correct, UpdateTableBuffer is just a way to get around the fact
that Epicor didn't allow DB writes in version 8.

As far as 'find first', 'if avail' etc, that's just a different way to
search. If you just need one record, you can do
FIND FIRST Table WHERE X = Y.
The 'IF Avail' is just used so the code doesn't try to execute against an
empty result set. If you use the FOR EACH syntax, it handles that
automatically. It fetches all the records that match and loops through
them. If it doesn't return anything, it doesn't loop. There are situations
where the 'FIND FIRST' method is the only way to go, but you'll know one
when you come across it. Generally it's preferable to use the 'FOR EACH'
syntax anytime you can get away with it. If nothing else, it's less wordy
and easier to read.

Generally you want to check the RowMod so you can find rows in the TT
tables that were updated or appended. It's pretty common when updating
order lines or something similar that you only want to edit the line being
modified. RowMod lets you find that row without jumping through a lot of
hoops.

It's good habit to use rowmod lest you accidentally update the wrong
record; though in this particular case you may not really need it. You want
to find and update all the releases for the orderheader --assuming I'm
following you correctly. If the only thing people are editing is the ship
date, you can safely fire it everytime as the BPM wouldn't be called if it
hadn't been changed. If you want to be a bit more slick and save a little
work for you DB you could do the following:

FOR EACH ttOrderHed WHERE ttOrderHed.RowMod <> '',
EACH OrderRel WHERE OrderRel.Company = ttOrderHed.Company AND
OrderRel.OrderNum = ttOrderHed.OrderNum AND OrderRel.ShipDate <>
ttOrderHed.ShipDate:
/* Do you assignments and whatnot here */
END.

That will only run against releases with shipdates that don't match the
order header. Double check the field names, I'm going off the top of my
head.


*John Driggers*
**
*Chief Data Wrangler*
*
*
*I have an Epicor blog <http://usdoingstuff.com/>. How useful is that?*
*
*:: 904.404.9233
:: waffqle@...
:: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>

*

*



On Wed, Aug 8, 2012 at 2:53 PM, Jose Gomez <jose@...> wrote:

> If you are in version 9X you don't need to use UpdateTbalebuffer
>
> *Jose C Gomez*
> *Software Engineer*
> *
> *
> *
> *T: 904.469.1524 mobile
> E: jose@...
> http://www.josecgomez.com
> <http://www.linkedin.com/in/josecgomez> <
> http://www.facebook.com/josegomez>
> <http://www.google.com/profiles/jose.gomez> <
> http://www.twitter.com/joc85>
> <http://www.josecgomez.com/professional-resume/>
> <http://www.josecgomez.com/feed/>
> <http://www.usdoingstuff.com>
>
> *Quis custodiet ipsos custodes?*
>
>
>
> On Wed, Aug 8, 2012 at 2:35 PM, that_guyy <rbird@...> wrote:
>
> > **
> >
> >
> > JOhn,
> > Thanks for the code & validation. I've been reading about the
> > recommendation to use the 'Run lib\UpdateTableBuffer.p()' instead, is
> there
> > a way to do that instead? Is this a 'safer' way... or with what I am
> trying
> > to do (for each) does this just get messy.
> >
> > I am assuming your bit of code is more or less a sample, I still need to
> > do all the RowMod value checks and the 'find OrderRel where' and 'if
> avail'
> > stuff, right?
> >
> > Sorry, I know just enough ABL to be dangerous.
> >
> > Thanks,
> >
> >
> > -Rick Bird
> > IT Software Administrator
> > Rowmark, LLC.
> >
> > --- In vantage@yahoogroups.com, John Driggers <waffqle@...> wrote:
> > >
> > > You're correct, you should be able to basically do:
> > >
> > > FOR EACH ttOrderHed,
> > > EACH OrderRel WHERE OrderRel.OrderNum = ttOrderHed.OrderNum:
> > > ASSIGN OrderRel.Field = Value.
> > > END.
> > >
> > > Adjust your where clause appropriately, but that should do it.
> > >
> > > *John Driggers*
> > > **
> > > *Chief Data Wrangler*
> > > *
> > > *
> > > *I have an Epicor blog <http://usdoingstuff.com/>. How useful is
> that?*
> > > *
> > > *:: 904.404.9233
> > > :: waffqle@...
> >
> > > :: http://www.usdoingstuff.com <http://www.usdoingstuff.com/>
> > >
> > > *
> > >
> > > *
> > >
> > >
> > >
> > > On Wed, Aug 8, 2012 at 12:14 PM, that_guyy <rbird@...> wrote:
> > >
> > > > **
> > > >
> > > >
> > > > I have an updatable dashboard that displays a list from OrderHed of
> > Orders
> > > > on Hold and no ship by date specified. Both fields are updatable. The
> > idea
> > > > was that our Customer Service could quickly set the shipby date and
> > take
> > > > the order off hold, which works except, since it's an updatable BAQ
> BPM
> > > > that does the update and not base, the Sales Order releases are not
> > getting
> > > > their ship by date updated (like it does in Order Entry).
> > > > What I think I can do is add to the ABL code on the Updatable BAQ BPM
> > to
> > > > update all the releases for that sales order to match the new ship
> > date.
> > > >
> > > > Other than 'reading' a value from a table, I have never tried to
> update
> > > > data to a table directly, I have always used what ever tt fields that
> > were
> > > > available to me in the BPM, in this case the OrderRel is not
> available
> > to
> > > > me, how do I 'get it'?
> > > >
> > > > Then I was thinking I could use a 'for each...' type of query or
> > whatever
> > > > to loop through all the OrderRel records and update the date.
> > > >
> > > > Any help on this would be most appreciated!
> > > >
> > > > -Rick Bird
> > > > IT Software Administrator
> > > > Rowmark, LLC.
> > > >
> > > >
> > > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> 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/linksYahoo! Groups Links
>
>
>
>


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