A question was recently raised on the biztalkgurus.com forum, that went something along the lines of:
I’ve seen the phrase Message2(*) = Message1(*) in the ‘helper text’ for the Message Assignment shape, but I’m not too sure what it does, or how it is different from Message2 = Message1. Any ideas?
I replied to the question, albeit in haste and posted an incorrect answer, stating that Message2 = Message 1 copies only the message parts and not the context, whereas Message2(*) = Message1(*) copies everything *including* the context. I was mercilessly shot down by both Tomas Restrepo and Stephen W. Thomas for providing an incorrect answer (thanks guys!).
In an attempt to save face, I spent some time today investigating exactly what that statement does (given that there is little useful information available on the interweb). As correctly answered by Tomas and Stephen:
Message2(*) = Message1(*) copies across only the *context* of the message and nothing else. The purpose of the statement is to allow you to copy context properties to a new message that has been created using a transformation (a map) as context properties aren’t copied across in a map.
In my test scenario, I created two messages: one from a map and a second from a map plus the construct statement above, to copy across the context properties. The results can be found in the following two screenshots: standalone transformation and transformation plus context properties. As you can see, the properties have been copied across in the latter.
Its usage would be something along the following lines – in a construct message shape, the statement would appear following a transformation (‘Apply Map’) in the Message Assignment shape (‘Two(*) = One(*)’):
It’s cool, Nick :) To be honest, I used to think that Msg1 = Msg2 would only copy the message content and not the context as well. The only reasons I knew better now was that a client had an issue with this and I had to do a bit of research to discover it copied the context as well :)
Nice going … I needed to know this for a whilst and it’s been on my backburner list of things to get to one day. Tick. One less item to research.
Hi,
Nice article, but I have a little problem.
As you are doing the copy of all the context properties –> Msg_out(*) = Msg_in(*) –> you’re also doing a copy of the BTS.MessageType context property. Which means, if your Msg_out has another BTS.MessageType (which in a lot of cases is normal after a mapping or transform), it’s overwritten by the BTS.MessageType of the Msg_in.
The Msg_out BTS.MessageType is that of the Msg_in.
Is there a way to copy the context properties of only a given property schema? Because if you’re doing a dynamic mapping in your expression shape (orchestration), you want to copy your context properties also in a dynamic way. And not one by one (e.g.: Msg_out(BTS.contextproperty01) = Msg_in(BTS.contextproperty01) ).
For me, it’s important that I copy all contextproperties, except the BTS.MessageType.
This because I’m using a lot of those contextproperties in my correlationset for promotion of properties when another process/orchestration has a subscription on the message after sending it to the messagebox.
I’m looking for a correct and simple way to do that.
Anyone who can help?
Thanks in advance!