XLANG/s exists operator

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.

posted @ Monday, October 15, 2007 12:00 PM

Print

Comments on this entry:

 re: XLANG/s exists operator

Left by eponymous at 2/5/2008 6:11 AM
Gravatar

now THAT is freaking awesome!

# re: XLANG/s exists operator

Left by Eric at 2/5/2008 8:12 AM
Gravatar

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!
:)

# re: XLANG/s exists operator

Left by Thiago Almeida at 2/6/2008 1:42 PM
Gravatar

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.

# re: XLANG/s exists operator

Left by Eric at 2/6/2008 2:01 PM
Gravatar

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

 re: XLANG/s exists operator

Left by DeMi at 5/19/2009 5:30 AM
Gravatar

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"

 re: XLANG/s exists operator

Left by David at 8/11/2009 2:02 PM
Gravatar

Just what I was looking for! Thx a lot for this! :)

# re: XLANG/s exists operator

Left by software developer at 8/27/2009 10:07 AM
Gravatar

Cool,

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

Thanks for bringing this up

Your comment:



 (will not be displayed)


 
 
 
Please add 3 and 4 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789