Oct 152007

A recent project I was developing I was required to pull data from either a file location or a FTP location, and based on the filename it was supposed to do something.

I started testing and I came across an XLANG/s error:

Shape name: Decide Type of Password Reset
ShapeId: 56e918c9-c009-4f4a-a722-a3f6c2f7dd55
Exception thrown from: segment 1, progress 15
Inner exception: There is no value associated with the property ‘FILE.ReceivedFileName’ in the message.

I had forgotten to change my code in the decision shape from testing just the File.ReceivedFileName to something more intelligent.

I started looking at how I could change the code. In this case I was pulling the data from an FTP location, so obviously, the FILE.ReceivedFileName did not exist in the message context. I thought of writing the code in an expression shape to be like this:

if(inputMsg(BTS.InboundTransportType)=="FILE") { filename=inputMsg(FILE.ReceivedFileName); } else { filename=inputMsg(FTP.ReceivedFileName); }

But I was not satisfied (am I ever?), I then looked at the XLANG/s operators and after reviewing the exists operator I came up with some different code:

if(FILE.ReceivedFileName exists inputMsg) { filename=inputMsg(FILE.ReceivedFileName); } else { filename=inputMsg(FTP.ReceivedFileName); }

Now there is no perceived benefit in using one way of extracting the filename compared to another, but it is just another arrow in the quiver.

  • eponymous

    now THAT is freaking awesome!

  • I am not sure about freaking awesome, but definately cool none-the-less.
    the freaking awesome is when the light goes on about what BAM can do, or when BizTalk v.Next is 100% wizard driven and there is no more coding needed!

  • I’ve been using the exists for a while, it should be advertised more. Good on you for posting this! I also use it on error handling orchestrations to check if the property exists before trying to write it’s value to an error email or event log entry.

  • Yes, this is perfect situation on where you would use the exists XLANG/s keyword.

  • DeMi

    This only works on BizTalk 2006. In BizTalk 2004 you will receive at design-time the error ” ‘exists’ keyword can only be used in a receive predicate”

  • David

    Just what I was looking for! Thx a lot for this! 🙂

  • Cool,

    excelent place to use this key word( XLANG/s keyword. )

    Thanks for bringing this up

  • Good stuff. Can be used to avoid those annoying exceptions. Thanks for posting this.


    t is also OK to know when to letwow gold someone die. It is going to happen at some point, but cheap wow goldit isn’t your fault. If you know someone is going to explode (say, that elemental shaman who just stole aggro) and you can either heal them or save another party member who isn’t a certain death, you may have to choose to let that ed hardy clothing first person die. If you can’t save someone and you try, you are only wasting mana. Being able to recognize this is huge.
    Our third lesson is learning what tools to use and for what. The very first boss in Vortex Pinnacle force

  • for bringing this up

  • sboman

    Hi Eric! Thanks for the info!! I had the following logic to get the error if (!string.IsNullOrEmpty(msg_In(FILE.ReceivedFileName)))