Hi,
I have a table with a field called Period whcih has numbers from 1 - 12. Now
I want to say that if the value of the field is 1 , then the report should
display january, if its 2 , Feburary and so on... Is there a way this can be
done without having to create a table ?
--
pmudYou can change your query to add column for month name
Oracle =Monthname(Extract Month from tempdate)
SQL server=DayPart("m",tempdate)
hope it helps.
"pmud" wrote:
> Hi,
> I have a table with a field called Period whcih has numbers from 1 - 12. Now
> I want to say that if the value of the field is 1 , then the report should
> display january, if its 2 , Feburary and so on... Is there a way this can be
> done without having to create a table ?
> --
> pmud|||Go to the Code tab of the Reports Properties dialog and add the following:
function MonthValue(byval MonthInt as integer) as string
select case MonthInt
case 1
return "Jan"
case 2
return "Feb"
'...
case else
return "Bad Month"
End select
end function
Then in the text box where you want the month to display place this
expression:
=Code.MonthValue( Fields!Period.Value)
You can read more about adding code by searching the help for 'Writing
Custom Code'
"pmud" wrote:
> Hi,
> I have a table with a field called Period whcih has numbers from 1 - 12. Now
> I want to say that if the value of the field is 1 , then the report should
> display january, if its 2 , Feburary and so on... Is there a way this can be
> done without having to create a table ?
> --
> pmud|||Hi Harolds,
That was very helpful.
Thanks
--
pmud
"Harolds" wrote:
> Go to the Code tab of the Reports Properties dialog and add the following:
> function MonthValue(byval MonthInt as integer) as string
> select case MonthInt
> case 1
> return "Jan"
> case 2
> return "Feb"
> '...
> case else
> return "Bad Month"
> End select
> end function
> Then in the text box where you want the month to display place this
> expression:
> =Code.MonthValue( Fields!Period.Value)
> You can read more about adding code by searching the help for 'Writing
> Custom Code'
> "pmud" wrote:
> > Hi,
> >
> > I have a table with a field called Period whcih has numbers from 1 - 12. Now
> > I want to say that if the value of the field is 1 , then the report should
> > display january, if its 2 , Feburary and so on... Is there a way this can be
> > done without having to create a table ?
> > --
> > pmud|||Thanks Guys, this helped me out as well
"pmud" wrote:
> Hi Harolds,
> That was very helpful.
> Thanks
> --
> pmud
>
> "Harolds" wrote:
> > Go to the Code tab of the Reports Properties dialog and add the following:
> >
> > function MonthValue(byval MonthInt as integer) as string
> > select case MonthInt
> > case 1
> > return "Jan"
> > case 2
> > return "Feb"
> > '...
> > case else
> > return "Bad Month"
> > End select
> > end function
> >
> > Then in the text box where you want the month to display place this
> > expression:
> >
> > =Code.MonthValue( Fields!Period.Value)
> >
> > You can read more about adding code by searching the help for 'Writing
> > Custom Code'
> >
> > "pmud" wrote:
> >
> > > Hi,
> > >
> > > I have a table with a field called Period whcih has numbers from 1 - 12. Now
> > > I want to say that if the value of the field is 1 , then the report should
> > > display january, if its 2 , Feburary and so on... Is there a way this can be
> > > done without having to create a table ?
> > > --
> > > pmud|||There is an easier way in the cell itself. There is a VB.net function
MonthName(), so
=MonthName(Month(Fields!MyDate.Value), True)
will give "Jan", "Feb" etc. Change the True to False and you'll get
full month names. I also think it is language aware, so will return the
month in the language the client system is set to.
--
Regards
Chris
Stephen L wrote:
> Thanks Guys, this helped me out as well
> "pmud" wrote:
> > Hi Harolds,
> >
> > That was very helpful.
> >
> > Thanks
> > --
> > pmud
> >
> >
> > "Harolds" wrote:
> >
> > > Go to the Code tab of the Reports Properties dialog and add the
> > > following:
> > >
> > > function MonthValue(byval MonthInt as integer) as string
> > > select case MonthInt
> > > case 1
> > > return "Jan"
> > > case 2
> > > return "Feb"
> > > '...
> > > case else
> > > return "Bad Month"
> > > End select
> > > end function
> > >
> > > Then in the text box where you want the month to display place
> > > this expression:
> > >
> > > =Code.MonthValue( Fields!Period.Value)
> > >
> > > You can read more about adding code by searching the help for
> > > 'Writing Custom Code'
> > >
> > > "pmud" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a table with a field called Period whcih has numbers
> > > > from 1 - 12. Now I want to say that if the value of the field
> > > > is 1 , then the report should display january, if its 2 ,
> > > > Feburary and so on... Is there a way this can be done without
> > > > having to create a table ?
> > > > --
> > > > pmud
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment