Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Monday, March 26, 2012

Noon to midnight formula help

I'm trying to write a custom formula to only show records that happened between noon and midnight over a specific date range. I have no problem with the date range but the time thing is killing me. The start time is in the ({Trips.calltime} table. The ending time is located in the {Trips.atstime} table. Thanks!What does 'happened' mean? Started on/after 12pm? Is the end time relevant?
Try the Time function, e.g.

and time({trips.calltime}) >= time(12,0,0)sql

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...