Question

I am working with Biztalk 2010 and I need to create a Schema, the problem is that an element of that Schema can have values of any Data Type.

I have attributes that have a type(e.g int, represented as a string), a name (e.g Age) and a Value of the attribute, which can be of any Datatype.

This is my Schema:

Attribute(Root Node)
   Type(element, Datatype: string)
   Name(element, Datatype: string)
   Value(this needs to support every Datatype)

How can I do this?

Was it helpful?

Solution

To elaborate on TJ Adams suggestion. For your incoming schema have the Value defined as a string field. Then when you need to type it, use a map which uses functoids with either in-line code or calls to an external helper class(1) to use TryParse methods to convert it into the right data type for the target schema/system. If it can't parse it as the right type return a string of "INVALID" and then use a Logic Date/Logical Number and a Value mapping functoid only to map it through if it could be parsed(2) and formatted correctly. I've had to do exactly this for a client where the input format was a CSV file and dates could be in multiple formats and numeric fields could also be empty.

(1) If you need to do it for lots of fields an external helper class is probably easier to maintain. (2) Trying it just with the Logical Fuctoids without parsing and formatting it can lead to problems as it might say it is a date or numeric, but it may not be in the correct format for the end system. I also passed a blank out if it was allowed to be a NULL and used the INVALID string to create a error in a validation message.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top