I was playing around with specifying ComplexFormatting and FormatString for my BCS model entities. Here are the lessons learnt:
- The ComplexFormatting property must be specified at the parent TypeDescriptor containing the complex type, not at the complex type TypeDescriptor itself. So for the model below, the ComplexFormatting property must be specified for the Staff TypeDescriptor, not Address.
- The ComplexFormatting property seems to have effect as long as it is specified, regardless of its value. This link http://msdn.microsoft.com/en-us/library/ff464405.aspx shows that the type of this property is Boolean. Most entries on the web however show that this property can be of type String, and can have an empty value. I have tested both, and they both work. Furthermore, setting the type to Boolean and specifying a value of false does not disable complex formatting.
- The FormatString property must be specified on the complex type TypeDescriptor. In the screenshot above, it needs to be specified on Address.
- I could not get complex formatting to work with SP external lists. I can only get the formatted value in custom code when calling entityInstance.GetFormatted(“Address”).
This article on MSDN gives an overview of the various options for dealing with complex type in BCS and pros/cons of each: http://22.214.171.124/en-us/library/ff798441.aspx.