Problem with an Add1 as the starting task of a transaction [message #3803] |
Thu, 25 July 2013 15:54 |
jjtoranzo2004
Messages: 261 Registered: September 2012
|
Senior Member |
|
|
Tony,
I created a new workflow with an Add1 transaction as the starting task. The table in question (REPORT) has an auto_increment primary key. The workflow starts normally, but the next transaction in the workflow (an Add2) is not referenced properly, because the context passed is report_id=0 instead of the proper one (e.g. report_id=3843)
(I checked it also saving in a file the $fieldarray variable inside the _cm_post_insertRecord () method).
The context is passed correctly if the starting tak is an Update1.
After reading a bit ( http://www.tonymarston.net/php-mysql/functions-and-variables .html#notes._dml_insertrecord ) I reached the conclusion that the Framework, using the method _dml_insertRecord (), should be able to obtain the auto-generated value from the database and insert it into the output array. And therefore, to use the generated id as the context in the next task using the _examineWorkflow () method. (Am I wrong?)
The problem only surfaced after including the task as a starting point of a workflow. In itself this Add1 transaction works normally, records are inserted with no problem. And after being created, from the LIST1 task I am able to jump to child task (such as a LIST2 transaction) with the correct context.
Any help or suggestion is appreciated. Thanks in advance.
|
|
|
|
Re: Problem with an Add1 as the starting task of a transaction [message #3806 is a reply to message #3805] |
Fri, 26 July 2013 08:55 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I have just done a test, and it worked exactly as it should. My starting task created a new record with an auto_increment value, and this value was correctly passed to the workflow case as the context. As I cannot see a problem with my test you will have to examine your own code to see what is happening. Can you checked the following:
(1) After the call to _dml_insertRecord() in the insertRecord() method within file 'std.table.class.inc' can you confirm that the returned array contains the newly created primary key?
(2) In the _examineWorkflow() method within file 'std.table.class.inc' can you confirm that the $context string is being constructed correctly? The $input array should contain the primary key field and its value, and the call to getPkeyNames() should return the name of the primary key field.
It could be that you have some code somewhere which is replacing the generated value with zero.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|