Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime to Month format

Status
Not open for further replies.

Jodes

Technical User
Jan 10, 2006
6
GB
I have a datetime field in the database, that I need to extract just the month from. I can do this in Oracle sql but I cannot figure out how to achieve this in MSTR.

At the report front end, I can alter the format of the datetime which will give the Month, but I need to create an attribute to extract the month so that I can use it as a filter in various reports.

This will be hitting a very large table & will return a lot of rows, so an efficient method is preferable if there are options.

Any suggestions?
 
Try using some of the date functions that are now available in 8.x or you can always use an applysimple to pass the Oracle functions in natively. The new functions in Microstrategy are pretty smart and convert the generic function to the database specific function when it queries the database.
 
Thanks reisw. I'll take a look at the Applysimple stuff & see if I can make sense of it.

I spoke to MSTR yesterday who advised creating a solution in the database - ie a new column in the db that extracts the month for me. In addition to this, they also recommended creating a db table that links on the date, with a column for each appropriate date detail - eg, date; day of week; week_id; month_id; quarter; year. This will definitely solve the problem, but it seems an awful lot of work when I already have the datetime in a column.

Hopefully, the applysimple will hold the solution.
Cheers,
Jodes.
 
This sorts out the problem:

ApplySimple("concat(to_char(date2, 'YYYY'),(to_char(date2, 'MM')))")

The attribute must have an attribute ID Form, as this applySimple only works as a Description Form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top