cancel
Showing results for 
Search instead for 
Did you mean: 

Based on today's date, how to find next monday?

Former Member
0 Kudos

My reports take a date and create report.

Date is static now. it shows default old date.

How can i make this dynamic date?.

Based on today's date, it should show next moday in parameter field. How can i do this?.

Please help me.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

this will find monday from given date.

http://technicalsupport.businessobjects.com/cs/forums/thread/702.aspx

IF DAYOFWEEK() > 1 THEN - (DAYOFWEEK() -2) ELSE -6

I want to find monday from current date, next monday.

How to do?.

Former Member
0 Kudos

How to find next monday from today's date?.

http://www.kenhamady.com/form21.shtml

Please help me.

Former Member
0 Kudos

Use what you found:

IF DAYOFWEEK() > 1 THEN - (DAYOFWEEK() -2) ELSE -6

Replace with currentdate (just type - currentdate - where ever yourdate appears. If this gives you the monday of the current week just add +7 to the end of the if line and the end of the else line

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello NewCR User,

try this:

IF DAYOFWEEK(currentdate) > 1 THEN (currentdate - (DAYOFWEEK(currentdate) -2)) +7

ELSE (currentdate -6) + 7

Cheers,

Fritz

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hehe Robert, you were quicker

Former Member
0 Kudos

Just by less than a minute.

Former Member
0 Kudos

Thanks..

IF DAYOFWEEK(currentdate) > 1 THEN (currentdate - (DAYOFWEEK(currentdate) -2)) +7

ELSE (currentdate -6) + 7

i created a formula with above content...

How can i use this formula as input parameter?.

Please let me know.

What i am trying to do...every time user goes to report, input date parameter should be next monday...he can pick any date...but default date user like to see is mondy....

how can i do this?.

find monday using formula and then use this formula as input parameter?.

i am not able to use formula as input parameter...how can i?.

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

The following record selection formula will take a user's input date, and select the data for the following Monday. Just copy this into your Record Selection Formula (Report > Selection Formulas > Record..).

datetimevar dt;

//{?enterdate} is your input date parameter (date time)
IF DAYOFWEEK({?enterdate}) > 1 THEN 
dt := ({?enterdate} - (DAYOFWEEK({?enterdate}) -2)) +7

ELSE 
dt := ({?enterdate} -6) + 7;

//{Table.Date} is your date field you want to filter data on
{Table.Date} = dt

Cheers,

Fritz

Former Member
0 Kudos

Ok, that cracks me up. The 2 quick draw artists are outdrawn by the newbie.

I think what you need is called "dynamic parameters".

You can put the date('s) in a table and pull that data from the database into your prompt. If you don't know how, or don't have permissions to do this, then you need to find someone who does. You can read up on "dynamic parameters" in the Crystal help files.

The Panda

Fritz got there while I was in conference. Looks good too.

...so, my way is just another way to go.

Edited by: pandabear on Jun 24, 2008 4:45 PM

Former Member
0 Kudos

thanks Fritz.

Here is what i want to do...

This formula will give me....... 06/30/2008

IF DAYOFWEEK(currentdate) > 1 THEN (currentdate - (DAYOFWEEK(currentdate) -2)) +7

ELSE (currentdate -6) + 7

How can i display 06/30/2008 as default date in input parameter?.

I think, crystal don't have a way to do this....any work around for this?

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

The formula I gave you will filter by next monday relative to the date entered by the user in the parameter.

If you want to display Mondays only in the parameter prompt, you need to do this on DB level, e.g. by returning a field that calculates which is the following Monday for each record (maybe using a command object, stored procedure or view?). Then you can use this field and its values to prompt the user (using a dynamic parameter).

In Crystal Reports designer, you can't enter a formula into the actual parameter default values. The default values have to either exist in the DB, or you enter them manually.

Cheers,

Fritz

Former Member
0 Kudos

we need this feature in new version of CR...where to request?

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

To request a feature for a new version, please contact [support|http://support.businessobjects.com/case_management/default.asp].

Cheers,

Fritz

Former Member
0 Kudos

can u please add this request to CR?

Former Member
0 Kudos

i can get monday by this sql...

select convert(varchar(10), dateadd(week, datediff(week, 0, getdate()) + 1, 0), 101)

I added this as command.

Changed parameter from static to dynamic...

Problem...after changing dynamic parameter....we can't input any parameter, if we want any other parameter other than dynamic value?

Answers (0)