Convert int to month name?  
Author Message
marvonmars





PostPosted: Tue Oct 26 15:25:03 CDT 2004 Top

SVCS >> Convert int to month name?

Is there an easy way of doing this?

I have a report where the user selects the month and year as parameters
passed in. I then want to show these on the report, but display the month as
month name rather than ordinal.

I tried using the GetMonthName function but it moans about it not
referencing an object.

The only way I can think of is to have a lengthy and unreadable 'switch'
statement.

Is there a better neater way of achieving this?

Information Technology234  
 
 
johnE





PostPosted: Tue Oct 26 15:25:03 CDT 2004 Top

SVCS >> Convert int to month name? Set up your month parameter as non quried and set values to the number 1- 12
set the labels as Jan-Dec. Whereever you want to display the month use this
expression

Parameters!<ParmeterName>.Label




> Is there an easy way of doing this?
>
> I have a report where the user selects the month and year as parameters
> passed in. I then want to show these on the report, but display the month as
> month name rather than ordinal.
>
> I tried using the GetMonthName function but it moans about it not
> referencing an object.
>
> The only way I can think of is to have a lengthy and unreadable 'switch'
> statement.
>
> Is there a better neater way of achieving this?
 
 
Flip





PostPosted: Tue Oct 26 15:39:07 CDT 2004 Top

SVCS >> Convert int to month name? I suspect that your data contains a date value.

In that case you could use it in stead of the parameter value:

Format(first(Fields!dateColumn.value), "MMMM")

My 2c.
Flip




> Is there an easy way of doing this?
>
> I have a report where the user selects the month and year as parameters
> passed in. I then want to show these on the report, but display the month as
> month name rather than ordinal.
>
> I tried using the GetMonthName function but it moans about it not
> referencing an object.
>
> The only way I can think of is to have a lengthy and unreadable 'switch'
> statement.
>
> Is there a better neater way of achieving this?
 
 
adolfgarlic





PostPosted: Wed Oct 27 03:55:01 CDT 2004 Top

SVCS >> Convert int to month name? works a treat
ta



> Set up your month parameter as non quried and set values to the number 1- 12
> set the labels as Jan-Dec. Whereever you want to display the month use this
> expression
>
> Parameters!<ParmeterName>.Label
>
>

>
> > Is there an easy way of doing this?
> >
> > I have a report where the user selects the month and year as parameters
> > passed in. I then want to show these on the report, but display the month as
> > month name rather than ordinal.
> >
> > I tried using the GetMonthName function but it moans about it not
> > referencing an object.
> >
> > The only way I can think of is to have a lengthy and unreadable 'switch'
> > statement.
> >
> > Is there a better neater way of achieving this?
 
 
adolfgarlic





PostPosted: Wed Oct 27 03:55:02 CDT 2004 Top

SVCS >> Convert int to month name? Nope this just gives the lyrics to a crash test dummies song
namely MMMM as the result
johnE's suggestion worked though




> I suspect that your data contains a date value.
>
> In that case you could use it in stead of the parameter value:
>
> Format(first(Fields!dateColumn.value), "MMMM")
>
> My 2c.
> Flip
>
>

>
> > Is there an easy way of doing this?
> >
> > I have a report where the user selects the month and year as parameters
> > passed in. I then want to show these on the report, but display the month as
> > month name rather than ordinal.
> >
> > I tried using the GetMonthName function but it moans about it not
> > referencing an object.
> >
> > The only way I can think of is to have a lengthy and unreadable 'switch'
> > statement.
> >
> > Is there a better neater way of achieving this?
 
 
BrianL





PostPosted: Fri Oct 27 12:59:02 CDT 2006 Top

SVCS >> Convert int to month name? I got the same result but figured it out. My query is passing just the month
number ( DATEPART(MM,DateField) ). So True argumen would error out. I changed
my expression to :

=Left(MONTHNAME(Fields!Month.Value),3)

So now it shows Jan, Feb, Mar, etc. rather than 1,2,3,etc.

Great tip, John E.



> Nope this just gives the lyrics to a crash test dummies song
> namely MMMM as the result
> johnE's suggestion worked though
>
>

>
> > I suspect that your data contains a date value.
> >
> > In that case you could use it in stead of the parameter value:
> >
> > Format(first(Fields!dateColumn.value), "MMMM")
> >
> > My 2c.
> > Flip
> >
> >

> >
> > > Is there an easy way of doing this?
> > >
> > > I have a report where the user selects the month and year as parameters
> > > passed in. I then want to show these on the report, but display the month as
> > > month name rather than ordinal.
> > >
> > > I tried using the GetMonthName function but it moans about it not
> > > referencing an object.
> > >
> > > The only way I can think of is to have a lengthy and unreadable 'switch'
> > > statement.
> > >
> > > Is there a better neater way of achieving this?