BPM data directive? store old data before update

Thanks for suggestions Jose and Greg ~
I've continued down the bpm route, in the hopes that this will be more easily converted when we upgrade to 10 sometime next year.

My code that works is below, in case anyone else goes looking someday.  PS, kudos to Rob Bucek for providing the early stages of it in this group in another posting.

I do want to note, for some reason, I could not get the code to work on a data directive bpm for when the orderrel.date01 field was changed from any to any.  I used the debug messages, and the strange thing is, in transaction data directive always shows the data as the new date, whether i've accessed it via the tt or via a lookup on the stored table data.  This is different when I run on the update method.  Also, i could not get the directive to run on looking at the rowmod = ' ', by way of data directive or method update directive.

That being said, the abl code below works for preprocessing BPM method directive on Order update to store original data (orderrel.date01) in another field (orderrel.date03) when the original data field (orderrel.date01) is changed, with stamp of user name (shortchar2) and date changed (date06).

__________________________
/*Create variable to hold old value and new value*/ 
DEF VAR msg AS CHARACTER NO-UNDO. 
DEF VAR origDate AS date NO-UNDO. 
DEF VAR newDate AS date NO-UNDO. 
DEF VAR OrdNum AS integer NO-UNDO. 
DEF VAR OrdLine AS integer NO-UNDO. 
DEF VAR OrdRel AS integer NO-UNDO.
Def Var CurUser AS Character NO-Undo.

/* find changed*/ 
FOR EACH ttOrderrel WHERE ttOrderRel.Company=CUR-COMP AND ttOrderRel.RowMod='U' no-lock: 

IF AVAIL ttOrderRel THEN 
DO: 
/* get the identifying record data to lookup what system holds before this update*/
OrdNum = (ttOrderrel.OrderNum). 
OrdLine = (ttOrderrel.OrderLine). 
OrdRel = (ttOrderrel.OrderRelNum). 
newDate = ttOrderRel.Date01.  
CurUser = ttCallContextClient.CurrentUserId.
/*msg = "RowMod:" + STRING(ttOrderRel.RowMod). 
{lib/PublishInfoMsg.i &InfoMsg = msg}. 
msg = "newDate:" + String(newDate). 
{lib/PublishInfoMsg.i &InfoMsg = msg}.*/

/*find associated earlier written data */
for each OrderRel where Orderrel.OrderNum = OrdNum and Orderrel.OrderLine = OrdLine and Orderrel.OrderRelNum = OrdRel no-lock:
if avail orderrel then do:
origDate = OrderRel.Date01.
assign ttOrderRel.Date03 = OrigDate.
assign ttOrderRel.ShortChar02 = CurUser.
assign ttOrderRel.Date06 = today.
/*msg = "origDate:" + String(origDate). 
{lib/PublishInfoMsg.i &InfoMsg = msg}.*/
End.
End.
End.
End.

Good Afternoon,


I'm trying to get an original date stored from OrderRel.Date01 written to OrderRel.Date06 when OrderRel.Date01 is changed.  


I used to have a BAM that sent email when the OrderRel.Date01 changed.  Everyone hates getting the emails.  Therefore, I want to make a dashboard that shows the current value of the order release Date01 field and the last value of the Date01 field, stored in the Date06 field.


I was thinking that an in transaction data directive on OrderRel.date01 change from any to any is the way to go.. but I can't seem to get a handle on the original value data for OrderRel.date01.  In the old BAM  I could access the "Old"table value.  What am I missing?  I've tried using tt order release reference vs not tt reference.  I've tried using assign statement versus write to buffer statement.  I can't get anything to work.


I've been at it all day.... anyone ever do anything like this with a bpm?  I keep avoiding trying to use the sales order update bpm because it holds so much updating (header, lines, releases) in it.... 


I have auditing on the field via a bam as well, but parsing the last changed data out of change log is not going to work nicely for the dashboard.


here's a little bit of what i've tried so far:

For each ttOrderRel where ttOrderRel.RowMod = 'U'.

Find first orderrel where orderrel.OrderNum = ttorderrel.ordernum and orderrel.OrderLine=ttorderrel.OrderLine and ttorderrel.OrderRelNum=orderrel.OrderRelNum no-lock.

if avail ttorderrel then do:

assign ttOrderRel.Date06 = orderrel.Date01.

end.

end.


thanks

Nancy



In the TT table there should be two rows, a row with a RowMOd="U" and a Row with No RowMod this Row with no RowMod should contain the "Old Data" Your other choice is to query the DB since you are doing os before its updated then querying the DB.Table will give you the "current" valye of the row


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Wed, Nov 25, 2015 at 2:49 PM, nhoyt111@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p>Good Afternoon,</p><p><br></p><p>I&#39;m trying to get an original date stored from OrderRel.Date01 written to OrderRel.Date06 when OrderRel.Date01 is changed.  </p><p><br></p><p>I used to have a BAM that sent email when the OrderRel.Date01 changed.  Everyone hates getting the emails.  Therefore, I want to make a dashboard that shows the current value of the order release Date01 field and the last value of the Date01 field, stored in the Date06 field.</p><p><br></p><p>I was thinking that an in transaction data directive on OrderRel.date01 change from any to any is the way to go.. but I can&#39;t seem to get a handle on the original value data for OrderRel.date01.  In the old BAM  I could access the &quot;Old&quot;table value.  What am I missing?  I&#39;ve tried using tt order release reference vs not tt reference.  I&#39;ve tried using assign statement versus write to buffer statement.  I can&#39;t get anything to work.</p><p><br></p><p>I&#39;ve been at it all day.... anyone ever do anything like this with a bpm?  I keep avoiding trying to use the sales order update bpm because it holds so much updating (header, lines, releases) in it.... </p><p><br></p><p>I have auditing on the field via a bam as well, but parsing the last changed data out of change log is not going to work nicely for the dashboard.</p><p><br></p><p>here&#39;s a little bit of what i&#39;ve tried so far:</p><p>For each ttOrderRel where ttOrderRel.RowMod = &#39;U&#39;.</p><p>Find first orderrel where orderrel.OrderNum = ttorderrel.ordernum and orderrel.OrderLine=ttorderrel.OrderLine and ttorderrel.OrderRelNum=orderrel.OrderRelNum no-lock.</p><p>if avail ttorderrel then do:</p><p>assign ttOrderRel.Date06 = orderrel.Date01.</p><p>end.</p><p>end.</p><p><br></p><p>thanks</p><p>Nancy</p><p><br></p><p><br></p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

in your bam .p program you can do the assign and then just set SendEmail = false

 

Greg

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, November 25, 2015 2:49 PM
To: vantage@yahoogroups.com
Subject: [Vantage] BPM data directive? store old data before update

 

 

Good Afternoon,

 

I'm trying to get an original date stored from OrderRel.Date01 written to OrderRel.Date06 when OrderRel.Date01 is changed.  

 

I used to have a BAM that sent email when the OrderRel.Date01 changed.  Everyone hates getting the emails.  Therefore, I want to make a dashboard that shows the current value of the order release Date01 field and the last value of the Date01 field, stored in the Date06 field.

 

I was thinking that an in transaction data directive on OrderRel.date01 change from any to any is the way to go.. but I can't seem to get a handle on the original value data for OrderRel.date01.  In the old BAM  I could access the "Old"table value.  What am I missing?  I've tried using tt order release reference vs not tt reference.  I've tried using assign statement versus write to buffer statement.  I can't get anything to work.

 

I've been at it all day.... anyone ever do anything like this with a bpm?  I keep avoiding trying to use the sales order update bpm because it holds so much updating (header, lines, releases) in it.... 

 

I have auditing on the field via a bam as well, but parsing the last changed data out of change log is not going to work nicely for the dashboard.

 

here's a little bit of what i've tried so far:

For each ttOrderRel where ttOrderRel.RowMod = 'U'.

Find first orderrel where orderrel.OrderNum = ttorderrel.ordernum and orderrel.OrderLine=ttorderrel.OrderLine and ttorderrel.OrderRelNum=orderrel.OrderRelNum no-lock.

if avail ttorderrel then do:

assign ttOrderRel.Date06 = orderrel.Date01.

end.

end.

 

thanks

Nancy

 

 




CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6240 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."