Value of a field prior to update, in a BPM

In a Pre-Process BPM, is it possible to retrieve the value of a field from before the update processes? (I kind of thought that was the whole idea of Pre-Process BPMS).

I thought the data in the dsTable_Name.FieldName was the value prior to the update, and the value in ttTable_Name.FieldName was the new or updated value.

But both of these return the same value - the value the field is changed to.

Here’s what I’m using for a test:

  • Ice.Report.Update / Pre-Processing / Log Report Change
    image

  • Condition 0
    image

  • Set Arg/Var Action

    • Set the oldDesc arg/var to the expression dsReportStyleRow.StyleDescription
  • Show Message 0

    • Ice.Report.Update / Pre
      From: <oldDesc/>
      To: <ttRptStylDesc/>

I was hoping the “From:” would show the old value and the “To:” would be the value it’s being changed to.

look in the ttTable for rowmods that arent Updated (U) or Added (A) maybe?

foreach(var rec in ttTable.Where(r =>!r.Updated() && !r.Added()))
{

}

I assumed that a Pre-Processing directiv is one that fires when a change needs to be made, but before the change is recorded. For exmaple, the order for a .Update Pre-Proc directive would be:

  1. Record is retrieved (no BPM activity)
  2. User edits value on form
  3. User saves, or does another function (like switch row) that requires the edited record to be updated. (this triggers the BPM)
  4. Pre-Proc BPM is entered. The table that requires updating has not yet been updated. The new values the original record will be updated, with are in ttTableName
  5. BPM processing takes place. Changes can be made to values in ttTableName
  6. BPM Exits
  7. Record in table TableName is updated with values in ttTableName

And that a Post-Proc BPM is:

  1. Record is retrieved (no BPM activity)
  2. User edits value on form
  3. User saves, or does another function (like switch row) that requires the edited record to be updated. (this triggers the BPM)
  4. Record in table TableName is updated with values in ttTableName
  5. Post-Proc BPM is entered. The original table that requires updating has already been updated.
  6. BPM processing takes place. Changes made to values in ttTableName will not affect the original table.
  7. BPM Exits

If the above are correct, I’d have to use a Pre-Proc to have access to the value before it is changed. Inside a Post-Proc BPM, the source table has already been updated.

Or am I way off?

I was sent this once… I think you have it pretty well but some of us do better with pictures, and this is why the Tracing is SO important… to see EXACTLY what method is called at what point.

image

3 Likes

You can view the current database values in a Pre-Processing BPM to get the ‘before’ values and use the ‘tt’ tables to view the after.

var beforeRow = (from row in Db.Project ...
var afterRow = (from row in ttProject ...

I figured I’d have to go with custom code over using the built-in blocks (still don’t know why DsReportStyle has the same info as ttReportStyle).

But I’m having problems accessing Ice tables.

Ice.Tables.ReportStyle rs;

rs = (from ReportStyle_Row in Db.ReportStyle
where ReportStyle_Row.Company == Session.CompanyID
select ReportStyle_Row).FirstOrDefault();

saves okay. But the following won’t:

Ice.Tables.ReportStyle rs;

rs = (from ReportStyle_Row in Db.ReportStyle
where ReportStyle_Row.Company == Session.CompanyID && ReportStyle_Row.ReportID == ttReportStyle.ReportID && ReportStyle_Row.StyleNum == ttReportStyle.StyleNum
select ReportStyle_Row).FirstOrDefault();

I get errors:

Error CS1593: Delegate 'System.Func<Ice.Tables.ReportStyle,int,bool>' does not take 1 arguments [Update.Pre.Log_Report_(Pre).cs(144,3)]
Error CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type [Update.Pre.Log_Report_(Pre).cs(144,3)]
Error CS1061: 'Ice.Tablesets.ReportStyleTable' does not contain a definition for 'ReportID' and no extension method 'ReportID' accepting a first argument of type 'Ice.Tablesets.ReportStyleTable' could be found (are you missing a using directive or an assembly reference?) [Update.Pre.Log_Report_(Pre).cs(145,49)]
Error CS1061: 'Ice.Tablesets.ReportStyleTable' does not contain a definition for 'StyleNum' and no extension method 'StyleNum' accepting a first argument of type 'Ice.Tablesets.ReportStyleTable' could be found (are you missing a using directive or an assembly reference?) [Update.Pre.Log_Report_(Pre).cs(146,49)]