Monday, March 12, 2012

Non value-type parameters in Assemblies/ CLR UDFs:

I am building a simple utitility to be hosted as a database assembly in SASS 2005. This is a .Net Assembly]

My method is date dependent and I want to pass in a DateTime rather than a string (globalisation issues.. you know the story). Can I do this and how would I pass this parameter in an MDX query?

I also want to pass in such thigs as the StorageMode enum etc. Presumably I can pass in the integer value... (kinda defeats the reason for using enums though)

Update to this, I find that you can pass the DateTime as a string and SSAS does some sort of implicit cast. this is still very sensitive to date string formatting, so is not ideal!|||

Well, it seems that after due consideration I have to answer my own post!

I think the problem is that we can only really pass in basic value types via text in queries, essentially strings and numbers. If I really want to pass in a class/struct I could pass in a string representing the XML Serialized class. For example, if I want to pass in a DateTime rather than a string, I could create an XML version of the DateTime structure. Of course, the alternative for dates would be to specify a universal format, such at the ISO format (yyyy-mm-dd) and ensure that this is rule is always adhered to, but this is coding by convention rather than using strong typing.

Now, my only problem is how to return data in a strongly typed format.... now the XML serialisation seems to be the answer to this one...

No comments:

Post a Comment