1

I've read conflicting things about this so before I start the work, can anyone confirm or otherwise if If statements will work inside BizTalk expression shapes?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
DarkW1nter
  • 2,933
  • 11
  • 67
  • 120

1 Answers1

2

Yes they do work, I've used them in a Biztalk 2006r2 expression shape (IF() {} else {} etc.).

You can't control the flow through the orchestration with them though. You will want to use a decide shape for that (which acts like an IF statement).

I tend to use IF statements in expressions to set a variable e.g. :

 if (somecondition)
 {
   somevariable = true;
 }
 else
 {
   somevariable = false;
 }

Hope that helps!

Richard Hanley
  • 328
  • 1
  • 10
  • Thanks, thats exactly what Im using it for. I have decide shape anyway, but when the flow goes down a particular branch I have an expression where I want to set variables depending on a condition. – DarkW1nter Feb 09 '12 at 14:03
  • certainly do-able. Also might be a bit overkill for your question but you know you can call a method on an assembly from the expressions too? So if you have a very complicated method that was pain to program into an expression you can just make a helper DLL. Reference it by adding a vairable and set the type to your .Net Class, remember to make your class Serializable though! There is an example here : http://www.codeproject.com/Articles/27288/Call-a-custom-NET-component-from-BizTalk-2006 – Richard Hanley Feb 09 '12 at 14:08
  • We do have a lot of helper classes, but for this particular thing its as simple as setting a few variables so the expression was my preferred option, Id just never seen (in here) conditions in an expression. thanks again – DarkW1nter Feb 09 '12 at 14:10