Wednesday, March 7, 2012

Expression Constraint and Precedence

I have a flow like this:

Container A
|
|
++
| |
| Container B
| |
| |
Container C That Both Connect To
I want to conditionally execute Container B based on a variable. I did this with a Precedence constraint on the line from A to B.

In this case however if it doesn't execute Container C doesn't execute. This is bad since Container C should always execute.

I changed the precedence constraint of B to C to be a logical Or and now Container C starts executing while Container B is executing! Not what I am looking for.

How do I do this? I thought about disabling Container B using an expression on the container but that seemed ugly.

Thanks,

ChrisHi Chris,
Wow, this is a weird one! I've had some fun trying to work this out Big Smile

1) Put B into a sequence container. Lets call our new sequence container "D".
2) Put an OnSuccess precedence constraint from A to D
3) Put an OnSuccess precedence constraint from A to C
4) Place a script task into D. It doesn't need any code in it because its not going to do anything
5) Put an expression precedence constraint from the script task to B.

B will execute depending on whatever you have in the expression on the precedence constraint (which is what you want) but C will always execute regardless!

You can download a demo of this solution from here: http://blogs.conchango.com/Admin/ImageGallery/blogs.conchango.com/jamie.thomson/20050727PrecedenceConstraintanomoly.zip
-Jamie

P.S. The link to your blog (www.vergentsoftware.com/blog/ckinsman) doesnt work. Well it didn't 30 seconds ago anyway.|||Put A and B into a sequence.
Put a precedence constraint between the sequence and C|||Thanks for the blog tip. I left out a letter.

Thanks also for the solution!

No comments:

Post a Comment