K2.processInstance.datafields("variable").value - what does this do behind the scenes?

  • 24 January 2008
  • 6 replies
  • 9 views

Badge +2

in a k2 studio solution - when you call k2.processinstance.datafields("variable").value...what does this actually do?  is this doing a database read everytime, and if so where is it reading from?  My question stems from the fact that we are doing a pretty big migration project now where we have been forced to edit some values in the database (with much help from a K2 consultant).  We believe we have made the correct updates including the process data field values necessary.  But when we are testing an existing process instance (originated before the updates were made)...it still appears to be using old values.  I am just curious there is something else to the equation i am not seeing.  Any help would greatly be appreciated.  Thanks.


6 replies

Badge +13

Check K2Log._ProcInstData.Name='your process data field'   to see if the old value is there.

_ProcInstData.ProcInstId = 

Badge +2
this is the weird thing...the value i find in that table is the 'new' value.   i see the old value in the repair error window as i debug. 
Badge +2

Also you might have to see the values in  k2._procdata and k2log._procdata. Also you can use SQL Profiler to see the data flow.

Badge +2

I have checked the following tables for the 'old' value and do not see it:


k2._ProcData


k2Log._ProcData


k2Log._ProcInstData


something strange i have just discovered is that K2.ProcessInstance.DataFields("variable").MetaData returns the 'new' (correct) value.  .Value returns the 'old' value.  Does this make any sense?  We updated both the Value and MetaData columns in the _ProcData table to have the new value but it still returning the old.

Badge +9

As I'm sure you're aware of, direct database manipulation is not a supported action.  That being said...


Any changes to K2Log data will have no affect on the active instance at run time.  K2Log is used exclusively for reporting.  The data in the K2 database is used by the K2Server at execution/runtime of that process instance.  The database structure of K2 differs slightly from K2Log when it gets to the instance data.  If memory servers me correctly, within the K2 database all process data is stored within a single binary field within the database, as opposed to individual fields, thus making it almost impossible to alter the data by directly editing the database.


If you must edit/alter Process Instance data fields I would highly recommend investigating the K2ROM OpenProcessInstance method.  There is a sample of how to use it here: http://k2underground.com/forums/thread/10319.aspx


HTH.

Badge +2
THANK YOU!!  this is what i have suspected all along but have not been able to prove it or have anyone tell me otherwise.  Although this answer does not make me happy about what we are going to have to do to fix the issue, i am glad to have some confirmation of my suspiscions.  Thanks again.

Reply