New to BPM questions

As a last thought, should I be using a specific condition? I presently don't define one. Shouldn't this fire every time then?
I am very new to BPMs. I have attached a preprocess to JobEntry.Update, and want to show a simple message. I must not have the syntax right or something.

for each ttJobHead WHERE (ttJobHead.RowMod='A' or ttJobHead.RowMod='U') no-lock.
find first ttJobProd WHERE (ttJobProd.JobNum=ttJobHead.JobNum) no-lock.
if available ttJobProd then
do:
{lib/PublishInfoMsg.i &InfoMsg = "'JobNum:' + ttJobProd.JobNum"}.
end.
else do:
{lib/PublishInfoMsg.i &InfoMsg = "'Not Found'"}.
end.
End.

Thoughts? If I remove the inner ttJobProd, it does fire. I eventually want to get to the SalesOrder Number in the popup, but am just trying to learn some 4GL.

What are some of the simple rules, like when to use a comma, period, or colon? Does each 'for each' and 'if then do' require an 'end.'?
Try this and see how that works out, your were almost on the money, this is how I would have done it though.



/* Declare your variable */
DEF VAR msg As Character no-undo.

/* Because its a tt or TEMP TABLE for short, we already have what we need, we just need to make use of it */
FIND FIRST ttJobProd WHERE ttJobProd.Company = Cur-Comp AND ttJobProd.RowMod = 'A' OR ttJobProd.RowMod = 'U' ) no-lock no-error.
IF AVAIL ttJobProd THEN DO:
msg = "JobNum: " + string(ttJobProd.JobNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }
END.


To answer a few of your other questions, the IFs do require the END. If your a C or JAVA developer, you may think of the ending periods as the semi colons your used to using in C. Example:

/////////////////4GL////////////////
IF AVAIL ttJobProd THEN DO:
msg = "JobNum: " + string(ttJobProd.JobNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }
END.
////////////////////////////////////



/////////////////C#////////////////

if (<my value>)
{
MessageBox.Show("Hello World");
}

Thanks and let me know how that works out :)
Chris Ryhal
Consultant
cryhal@...
317-364-2134

--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> I am very new to BPMs. I have attached a preprocess to JobEntry.Update, and want to show a simple message. I must not have the syntax right or something.
>
> for each ttJobHead WHERE (ttJobHead.RowMod='A' or ttJobHead.RowMod='U') no-lock.
> find first ttJobProd WHERE (ttJobProd.JobNum=ttJobHead.JobNum) no-lock.
> if available ttJobProd then
> do:
> {lib/PublishInfoMsg.i &InfoMsg = "'JobNum:' + ttJobProd.JobNum"}.
> end.
> else do:
> {lib/PublishInfoMsg.i &InfoMsg = "'Not Found'"}.
> end.
> End.
>
> Thoughts? If I remove the inner ttJobProd, it does fire. I eventually want to get to the SalesOrder Number in the popup, but am just trying to learn some 4GL.
>
> What are some of the simple rules, like when to use a comma, period, or colon? Does each 'for each' and 'if then do' require an 'end.'?
>
OK Here's what I went with. And still doesn't work quite right. The first time I opened Job Enty and unchecked Released from a previously saved Job, I got the Not Found popup. It only seems to fire when I release the job, which I guess makes sense for ttJobProd. You sure I don't need to reference ttJobHead first? I am trying to ultimately get to OrderHed.OrderNum, and I believe JobProd is the only link from SalesOrder.

DEF VAR msg As Character no-undo.
FIND FIRST ttJobProd WHERE (ttJobProd.RowMod = 'A' OR ttJobProd.RowMod = 'U' ) no-lock no-error.
IF AVAIL ttJobProd THEN DO:
msg = "JobNum: " + string(ttJobProd.JobNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }
END.
ELSE DO:
msg = "Not Found".
{lib/PublishInfoMsg.i &InfoMsg = msg }.
END.

As far as syntax, what about periods? from some of the examples I've seen, they behave like C semicolons. Also, do you have to bounce the session (i.e. change company) to see changes to a BPM or are they effective upon save?

--- In vantage@yahoogroups.com, "Christopher R" <cryhal@...> wrote:
>
> Try this and see how that works out, your were almost on the money, this is how I would have done it though.
>
>
>
> /* Declare your variable */
> DEF VAR msg As Character no-undo.
>
> /* Because its a tt or TEMP TABLE for short, we already have what we need, we just need to make use of it */
> FIND FIRST ttJobProd WHERE ttJobProd.Company = Cur-Comp AND ttJobProd.RowMod = 'A' OR ttJobProd.RowMod = 'U' ) no-lock no-error.
> IF AVAIL ttJobProd THEN DO:
> msg = "JobNum: " + string(ttJobProd.JobNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }
> END.
>
>
> To answer a few of your other questions, the IFs do require the END. If your a C or JAVA developer, you may think of the ending periods as the semi colons your used to using in C. Example:
>
> /////////////////4GL////////////////
> IF AVAIL ttJobProd THEN DO:
> msg = "JobNum: " + string(ttJobProd.JobNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }
> END.
> ////////////////////////////////////
>
>
>
> /////////////////C#////////////////
>
> if (<my value>)
> {
> MessageBox.Show("Hello World");
> }
>
> Thanks and let me know how that works out :)
> Chris Ryhal
> Consultant
> cryhal@...
> 317-364-2134
>
> --- In vantage@yahoogroups.com, "k99ja04" <jallmond@> wrote:
> >
> > I am very new to BPMs. I have attached a preprocess to JobEntry.Update, and want to show a simple message. I must not have the syntax right or something.
> >
> > for each ttJobHead WHERE (ttJobHead.RowMod='A' or ttJobHead.RowMod='U') no-lock.
> > find first ttJobProd WHERE (ttJobProd.JobNum=ttJobHead.JobNum) no-lock.
> > if available ttJobProd then
> > do:
> > {lib/PublishInfoMsg.i &InfoMsg = "'JobNum:' + ttJobProd.JobNum"}.
> > end.
> > else do:
> > {lib/PublishInfoMsg.i &InfoMsg = "'Not Found'"}.
> > end.
> > End.
> >
> > Thoughts? If I remove the inner ttJobProd, it does fire. I eventually want to get to the SalesOrder Number in the popup, but am just trying to learn some 4GL.
> >
> > What are some of the simple rules, like when to use a comma, period, or colon? Does each 'for each' and 'if then do' require an 'end.'?
> >
>
First, I have found that while you think the rowmod will always be an "A" or
"U" (or "D" for deletes), that's not ALWAYS the case. If you're not getting
what you want, sometimes I'll put in testing code:

FOR EACH ttJobProd:
Msg = "Found Job " + ttJobProd.JobNum + ", rowmod = " +
ttJobProd.RowMod.
{lib/PublishInfoMsg.i &InfoMsg = msg }
END.

That type of code tells me what I'm working with. The RowMod is as you
would expect it, but not always.

Is there a reason you're using JobProd instead of JobHead? I'm not sure if
JobProd gets updated in the tt when you check the release box.

With regards to BPM's, saves take place immediately. You can have Method
Directives open and Job Entry, click save, and just alt-tab between screens.
Don't forget to click save when coming out of the actions, it's easy to
click OK to the 4GL screens, but forget to save.

With regards to the colons and ENDs, a good rule of thumb is when you have a
colon, you'll have an END. I've gotten in the habit of whenever I type a
colon (on a DO: or FOR EACH..:), I type the END right away, then fill in the
code.

Hope that helps.

Kevin Simon
SimsTrak Consulting
On Wed, Aug 4, 2010 at 5:20 PM, k99ja04 <jallmond@...> wrote:

>
>
> OK Here's what I went with. And still doesn't work quite right. The first
> time I opened Job Enty and unchecked Released from a previously saved Job, I
> got the Not Found popup. It only seems to fire when I release the job, which
> I guess makes sense for ttJobProd. You sure I don't need to reference
> ttJobHead first? I am trying to ultimately get to OrderHed.OrderNum, and I
> believe JobProd is the only link from SalesOrder.
>
>
> DEF VAR msg As Character no-undo.
> FIND FIRST ttJobProd WHERE (ttJobProd.RowMod = 'A' OR ttJobProd.RowMod =
> 'U' ) no-lock no-error.
>
> IF AVAIL ttJobProd THEN DO:
> msg = "JobNum: " + string(ttJobProd.JobNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }
> END.
> ELSE DO:
> msg = "Not Found".
>
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> END.
>
> As far as syntax, what about periods? from some of the examples I've seen,
> they behave like C semicolons. Also, do you have to bounce the session (i.e.
> change company) to see changes to a BPM or are they effective upon save?
>
> --- In vantage@yahoogroups.com <vantage%40yahoogroups.com>, "Christopher
> R" <cryhal@...> wrote:
> >
> > Try this and see how that works out, your were almost on the money, this
> is how I would have done it though.
> >
> >
> >
> > /* Declare your variable */
> > DEF VAR msg As Character no-undo.
> >
> > /* Because its a tt or TEMP TABLE for short, we already have what we
> need, we just need to make use of it */
> > FIND FIRST ttJobProd WHERE ttJobProd.Company = Cur-Comp AND
> ttJobProd.RowMod = 'A' OR ttJobProd.RowMod = 'U' ) no-lock no-error.
> > IF AVAIL ttJobProd THEN DO:
> > msg = "JobNum: " + string(ttJobProd.JobNum).
> > {lib/PublishInfoMsg.i &InfoMsg = msg }
> > END.
> >
> >
> > To answer a few of your other questions, the IFs do require the END. If
> your a C or JAVA developer, you may think of the ending periods as the semi
> colons your used to using in C. Example:
> >
> > /////////////////4GL////////////////
> > IF AVAIL ttJobProd THEN DO:
> > msg = "JobNum: " + string(ttJobProd.JobNum).
> > {lib/PublishInfoMsg.i &InfoMsg = msg }
> > END.
> > ////////////////////////////////////
> >
> >
> >
> > /////////////////C#////////////////
> >
> > if (<my value>)
> > {
> > MessageBox.Show("Hello World");
> > }
> >
> > Thanks and let me know how that works out :)
> > Chris Ryhal
> > Consultant
> > cryhal@...
>
> > 317-364-2134
> >
> > --- In vantage@yahoogroups.com <vantage%40yahoogroups.com>, "k99ja04"
> <jallmond@> wrote:
> > >
> > > I am very new to BPMs. I have attached a preprocess to JobEntry.Update,
> and want to show a simple message. I must not have the syntax right or
> something.
> > >
> > > for each ttJobHead WHERE (ttJobHead.RowMod='A' or ttJobHead.RowMod='U')
> no-lock.
> > > find first ttJobProd WHERE (ttJobProd.JobNum=ttJobHead.JobNum) no-lock.
> > > if available ttJobProd then
> > > do:
> > > {lib/PublishInfoMsg.i &InfoMsg = "'JobNum:' + ttJobProd.JobNum"}.
> > > end.
> > > else do:
> > > {lib/PublishInfoMsg.i &InfoMsg = "'Not Found'"}.
> > > end.
> > > End.
> > >
> > > Thoughts? If I remove the inner ttJobProd, it does fire. I eventually
> want to get to the SalesOrder Number in the popup, but am just trying to
> learn some 4GL.
> > >
> > > What are some of the simple rules, like when to use a comma, period, or
> colon? Does each 'for each' and 'if then do' require an 'end.'?
> > >
> >
>
>
>


[Non-text portions of this message have been removed]
When I'm not finding the data I am expecting, I'll use the show informational action to show what is actually in the tt table. Often I find the tt is not populated with any data.
Depending on exactly what you are doing, you can use the last saved values to the db by directly accessing the db table with no locking.

Hopefully someone's ideas will get you to a solution.

--- In vantage@yahoogroups.com, Kevin Simon <ksimon8fw@...> wrote:
>
> First, I have found that while you think the rowmod will always be an "A" or
> "U" (or "D" for deletes), that's not ALWAYS the case. If you're not getting
> what you want, sometimes I'll put in testing code:
>
> FOR EACH ttJobProd:
> Msg = "Found Job " + ttJobProd.JobNum + ", rowmod = " +
> ttJobProd.RowMod.
> {lib/PublishInfoMsg.i &InfoMsg = msg }
> END.
>
> That type of code tells me what I'm working with. The RowMod is as you
> would expect it, but not always.
>
> Is there a reason you're using JobProd instead of JobHead? I'm not sure if
> JobProd gets updated in the tt when you check the release box.
>
> With regards to BPM's, saves take place immediately. You can have Method
> Directives open and Job Entry, click save, and just alt-tab between screens.
> Don't forget to click save when coming out of the actions, it's easy to
> click OK to the 4GL screens, but forget to save.
>
> With regards to the colons and ENDs, a good rule of thumb is when you have a
> colon, you'll have an END. I've gotten in the habit of whenever I type a
> colon (on a DO: or FOR EACH..:), I type the END right away, then fill in the
> code.
>
> Hope that helps.
>
> Kevin Simon
> SimsTrak Consulting
> On Wed, Aug 4, 2010 at 5:20 PM, k99ja04 <jallmond@...> wrote:
>
> >
> >
> > OK Here's what I went with. And still doesn't work quite right. The first
> > time I opened Job Enty and unchecked Released from a previously saved Job, I
> > got the Not Found popup. It only seems to fire when I release the job, which
> > I guess makes sense for ttJobProd. You sure I don't need to reference
> > ttJobHead first? I am trying to ultimately get to OrderHed.OrderNum, and I
> > believe JobProd is the only link from SalesOrder.
> >
> >
> > DEF VAR msg As Character no-undo.
> > FIND FIRST ttJobProd WHERE (ttJobProd.RowMod = 'A' OR ttJobProd.RowMod =
> > 'U' ) no-lock no-error.
> >
> > IF AVAIL ttJobProd THEN DO:
> > msg = "JobNum: " + string(ttJobProd.JobNum).
> > {lib/PublishInfoMsg.i &InfoMsg = msg }
> > END.
> > ELSE DO:
> > msg = "Not Found".
> >
> > {lib/PublishInfoMsg.i &InfoMsg = msg }.
> > END.
> >
> > As far as syntax, what about periods? from some of the examples I've seen,
> > they behave like C semicolons. Also, do you have to bounce the session (i.e.
> > change company) to see changes to a BPM or are they effective upon save?
> >
> > --- In vantage@yahoogroups.com <vantage%40yahoogroups.com>, "Christopher
> > R" <cryhal@> wrote:
> > >
> > > Try this and see how that works out, your were almost on the money, this
> > is how I would have done it though.
> > >
> > >
> > >
> > > /* Declare your variable */
> > > DEF VAR msg As Character no-undo.
> > >
> > > /* Because its a tt or TEMP TABLE for short, we already have what we
> > need, we just need to make use of it */
> > > FIND FIRST ttJobProd WHERE ttJobProd.Company = Cur-Comp AND
> > ttJobProd.RowMod = 'A' OR ttJobProd.RowMod = 'U' ) no-lock no-error.
> > > IF AVAIL ttJobProd THEN DO:
> > > msg = "JobNum: " + string(ttJobProd.JobNum).
> > > {lib/PublishInfoMsg.i &InfoMsg = msg }
> > > END.
> > >
> > >
> > > To answer a few of your other questions, the IFs do require the END. If
> > your a C or JAVA developer, you may think of the ending periods as the semi
> > colons your used to using in C. Example:
> > >
> > > /////////////////4GL////////////////
> > > IF AVAIL ttJobProd THEN DO:
> > > msg = "JobNum: " + string(ttJobProd.JobNum).
> > > {lib/PublishInfoMsg.i &InfoMsg = msg }
> > > END.
> > > ////////////////////////////////////
> > >
> > >
> > >
> > > /////////////////C#////////////////
> > >
> > > if (<my value>)
> > > {
> > > MessageBox.Show("Hello World");
> > > }
> > >
> > > Thanks and let me know how that works out :)
> > > Chris Ryhal
> > > Consultant
> > > cryhal@
> >
> > > 317-364-2134
> > >
> > > --- In vantage@yahoogroups.com <vantage%40yahoogroups.com>, "k99ja04"
> > <jallmond@> wrote:
> > > >
> > > > I am very new to BPMs. I have attached a preprocess to JobEntry.Update,
> > and want to show a simple message. I must not have the syntax right or
> > something.
> > > >
> > > > for each ttJobHead WHERE (ttJobHead.RowMod='A' or ttJobHead.RowMod='U')
> > no-lock.
> > > > find first ttJobProd WHERE (ttJobProd.JobNum=ttJobHead.JobNum) no-lock.
> > > > if available ttJobProd then
> > > > do:
> > > > {lib/PublishInfoMsg.i &InfoMsg = "'JobNum:' + ttJobProd.JobNum"}.
> > > > end.
> > > > else do:
> > > > {lib/PublishInfoMsg.i &InfoMsg = "'Not Found'"}.
> > > > end.
> > > > End.
> > > >
> > > > Thoughts? If I remove the inner ttJobProd, it does fire. I eventually
> > want to get to the SalesOrder Number in the popup, but am just trying to
> > learn some 4GL.
> > > >
> > > > What are some of the simple rules, like when to use a comma, period, or
> > colon? Does each 'for each' and 'if then do' require an 'end.'?
> > > >
> > >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
I think I've got something deeper wrong with my BPM configuration. I ran the code below, and get nothing. I tried changing various fields on Job Entry and still zilch.

FOR EACH ttJobHead:
msg = "Found Job " + ttJobHead.JobNum + ", rowmod = " + ttJobHead.RowMod.
{lib/PublishInfoMsg.i &InfoMsg = msg }.
END.

Please tell me if this sounds right. I added a Startup Schedule to the System Agent. Then under Systems Management > BPM > Gen Ops > Action Process, I submitted it to the Startup Schedule I created. I then stopped and restarted ProcessServer and TaskAgent from Progress Explorer tool. What am I missing? Can someone give me concrete example code that should fire an info popup every time something in Job Entry is Updated? Which field should I alter to try and trigger this BPM?
Thanks for all the pointers!

--- In vantage@yahoogroups.com, Kevin Simon <ksimon8fw@...> wrote:
>
> First, I have found that while you think the rowmod will always be an "A" or
> "U" (or "D" for deletes), that's not ALWAYS the case. If you're not getting
> what you want, sometimes I'll put in testing code:
>
> FOR EACH ttJobProd:
> Msg = "Found Job " + ttJobProd.JobNum + ", rowmod = " +
> ttJobProd.RowMod.
> {lib/PublishInfoMsg.i &InfoMsg = msg }
> END.
>
> That type of code tells me what I'm working with. The RowMod is as you
> would expect it, but not always.
>
> Is there a reason you're using JobProd instead of JobHead? I'm not sure if
> JobProd gets updated in the tt when you check the release box.
>
> With regards to BPM's, saves take place immediately. You can have Method
> Directives open and Job Entry, click save, and just alt-tab between screens.
> Don't forget to click save when coming out of the actions, it's easy to
> click OK to the 4GL screens, but forget to save.
>
> With regards to the colons and ENDs, a good rule of thumb is when you have a
> colon, you'll have an END. I've gotten in the habit of whenever I type a
> colon (on a DO: or FOR EACH..:), I type the END right away, then fill in the
> code.
>
> Hope that helps.
>
> Kevin Simon
> SimsTrak Consulting