It is not hard to initialize an empty group element in a BizTalk map. After ten years of BizTalk, I don’t remember having to do it before, and at first, I thought I would have to create an XSLT functoid. That works to, but here is the easy way.

I had a customer who had an element called Condition with an “array” of int element under it. For some reason, when there was not a single value of “int” being set, they still wanted the parent element “” to be created.

I almost always use the “String Concatenate” functoid to initialize a new field. My fear of using it was that I thought I had to put a value in the “Value” column. You see below there is a yellow warning sign to the left, indicating no value has been set.

InitializeEmptyGroupElement1

While it’s true that you do need a value, the value can be an empty string. Just click in the “Value” column, then click back on the “Name” column, and the icon changes to a white check box in a green circle.

InitializeEmptyGroupElement2

You probably already know that you can right click the Map in solution explorer, then select “Validate Map” to see the XSL generated. Here is what was generated for the above case.

InitializeEmptyGroupElement3_XSLT

The value from the GUI that is typed in, or in this specific class, when I just clicked on the field is highlighted in yellow. It is set to $var:v1 which is put as the value of the element.

Filed under: Maps