Tuesday, March 27, 2012

DayOfWeek Function

Would like to set a date parameter default in the report designer based on
the day of the week. So if it was Monday, then the default date would be set
to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
there a dayOfWeek function that be used in an expression that returns either
the numeric or the alpha of the week?
GlassHi,
You can easely use the expression <code>=WeekDay(Now())</code> for
retrieving the actual weekday. This combined with an IIF expression you can
create the behaviour you need, like
<code>
=IIF(WeekDay(Now())=2, Now.AddDays(-3), Now.AddDays(-1))
</code>
Hope this would help you
Jan Pieter Posthuma
"Glass" wrote:
> Would like to set a date parameter default in the report designer based on
> the day of the week. So if it was Monday, then the default date would be set
> to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
> there a dayOfWeek function that be used in an expression that returns either
> the numeric or the alpha of the week?
> Glass|||Jan Pieter... It worked great. Have two ancillary question: what is the
difference between today and now? Is there a list of functions that are
valid in report server for use in expressions? Online books didn't seem to
help here.
Appreciate the help...
Glass
"Jan Pieter Posthuma" wrote:
> Hi,
> You can easely use the expression <code>=WeekDay(Now())</code> for
> retrieving the actual weekday. This combined with an IIF expression you can
> create the behaviour you need, like
> <code>
> =IIF(WeekDay(Now())=2, Now.AddDays(-3), Now.AddDays(-1))
> </code>
> Hope this would help you
> Jan Pieter Posthuma
>
> "Glass" wrote:
> > Would like to set a date parameter default in the report designer based on
> > the day of the week. So if it was Monday, then the default date would be set
> > to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
> > there a dayOfWeek function that be used in an expression that returns either
> > the numeric or the alpha of the week?
> >
> > Glass|||Glass,
There is a little difference between Now() and Today(). Both return the same
date, but Now returns the actual time and Today will allways return 12AM
back. So for today:
=Now() returns 6/22/2005 9:55:04 AM
=Today() returns 6/22/2005 12:00:00 AM
I must say: I use Now mainly because of my history with VB.NET.
Jan Pieter Posthuma
"Glass" wrote:
> Jan Pieter... It worked great. Have two ancillary question: what is the
> difference between today and now? Is there a list of functions that are
> valid in report server for use in expressions? Online books didn't seem to
> help here.
> Appreciate the help...
> Glass
> "Jan Pieter Posthuma" wrote:
> > Hi,
> >
> > You can easely use the expression <code>=WeekDay(Now())</code> for
> > retrieving the actual weekday. This combined with an IIF expression you can
> > create the behaviour you need, like
> > <code>
> > =IIF(WeekDay(Now())=2, Now.AddDays(-3), Now.AddDays(-1))
> > </code>
> >
> > Hope this would help you
> >
> > Jan Pieter Posthuma
> >
> >
> >
> > "Glass" wrote:
> >
> > > Would like to set a date parameter default in the report designer based on
> > > the day of the week. So if it was Monday, then the default date would be set
> > > to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
> > > there a dayOfWeek function that be used in an expression that returns either
> > > the numeric or the alpha of the week?
> > >
> > > Glass|||Thank you very much...
Glass
"Jan Pieter Posthuma" wrote:
> Glass,
> There is a little difference between Now() and Today(). Both return the same
> date, but Now returns the actual time and Today will allways return 12AM
> back. So for today:
> =Now() returns 6/22/2005 9:55:04 AM
> =Today() returns 6/22/2005 12:00:00 AM
> I must say: I use Now mainly because of my history with VB.NET.
> Jan Pieter Posthuma
> "Glass" wrote:
> > Jan Pieter... It worked great. Have two ancillary question: what is the
> > difference between today and now? Is there a list of functions that are
> > valid in report server for use in expressions? Online books didn't seem to
> > help here.
> >
> > Appreciate the help...
> >
> > Glass
> >
> > "Jan Pieter Posthuma" wrote:
> >
> > > Hi,
> > >
> > > You can easely use the expression <code>=WeekDay(Now())</code> for
> > > retrieving the actual weekday. This combined with an IIF expression you can
> > > create the behaviour you need, like
> > > <code>
> > > =IIF(WeekDay(Now())=2, Now.AddDays(-3), Now.AddDays(-1))
> > > </code>
> > >
> > > Hope this would help you
> > >
> > > Jan Pieter Posthuma
> > >
> > >
> > >
> > > "Glass" wrote:
> > >
> > > > Would like to set a date parameter default in the report designer based on
> > > > the day of the week. So if it was Monday, then the default date would be set
> > > > to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
> > > > there a dayOfWeek function that be used in an expression that returns either
> > > > the numeric or the alpha of the week?
> > > >
> > > > Glass|||"Glass" skrev:
> Thank you very much...
> Glass
> "Jan Pieter Posthuma" wrote:
> > Glass,
> >
> > There is a little difference between Now() and Today(). Both return the same
> > date, but Now returns the actual time and Today will allways return 12AM
> > back. So for today:
> > =Now() returns 6/22/2005 9:55:04 AM
> > =Today() returns 6/22/2005 12:00:00 AM
> >
> > I must say: I use Now mainly because of my history with VB.NET.
> >
> > Jan Pieter Posthuma
> >
> > "Glass" wrote:
> >
> > > Jan Pieter... It worked great. Have two ancillary question: what is the
> > > difference between today and now? Is there a list of functions that are
> > > valid in report server for use in expressions? Online books didn't seem to
> > > help here.
> > >
> > > Appreciate the help...
> > >
> > > Glass
> > >
> > > "Jan Pieter Posthuma" wrote:
> > >
> > > > Hi,
> > > >
> > > > You can easely use the expression <code>=WeekDay(Now())</code> for
> > > > retrieving the actual weekday. This combined with an IIF expression you can
> > > > create the behaviour you need, like
> > > > <code>
> > > > =IIF(WeekDay(Now())=2, Now.AddDays(-3), Now.AddDays(-1))
> > > > </code>
> > > >
> > > > Hope this would help you
> > > >
> > > > Jan Pieter Posthuma
> > > >
> > > >
> > > >
> > > > "Glass" wrote:
> > > >
> > > > > Would like to set a date parameter default in the report designer based on
> > > > > the day of the week. So if it was Monday, then the default date would be set
> > > > > to =today.adddays(-3) otherwise it would default to =today.adddays(-1). Is
> > > > > there a dayOfWeek function that be used in an expression that returns either
> > > > > the numeric or the alpha of the week?
> > > > >
> > > > > Glass
anna jag behöver verkligen din hjälp nuu !!sql

No comments:

Post a Comment