Re: Workflow implementation question [message #2778 is a reply to message #2777] |
Tue, 16 August 2011 06:43 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
It sounds like you need to make use of an Explicit OR-split with a guard, as shown in example #4 in Workflow Examples. In your case you need to create a workflow with the following:
1) Your start task is your ADD1 task.
2) There will be one place P1.
3) There will be two transitions:
- T1 (check for missing data), type=automatic
- T2 (add missing data), type=user
4) There will be five arcs:
- Start -> T1, Inward, Sequential
- T1 -> END, Outward, Explicit OR split, Guard= if (strlen($fieldarray['data']) < 1) return TRUE;
- T1 -> P1, Outward, Explicit OR split
- P1 -> T2, Inward, Sequential
- T2 -> END, Outward, Sequential
Transition T1 should be built using pattern UPDATE4. Although it will not actually update the database is has to end with a COMMIT so the the workflow engine knows that the transition has ended. You must ensure that $fieldarray contains the value that will be checked in the guard. For example, if you had multiple fields to check you could create a dummy field, such as GUARD_CONDITION, and set this to either TRUE of FALSE in your code.
When the workflow is started with the ADD1 task transition T1 will be fired automatically, and the guard will be evaluated. If TRUE the workflow will end, otherwise a token wil be placed on P1 which will wait for transition T2 to be fired. When T2 has been processed the workflow will end.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|