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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Parameters/Formulas for DateMonth

Status
Not open for further replies.

mycrystalbaby

Programmer
Jun 16, 2005
42
0
0
US
Hi,
I would really appriciate, if somebody could help me with this.
I am using a CR-X with SQL8.0.
I am trying to create a report which has a sub report as well.
I would like to have a parameter for this report as a text box, so user can write a number there.

It will be to enter a Month.

i.e if the user enter 1, then it should take it as a current month, if the user enter 2, it should give the data for currentmonth+1 and so on.
I would like to make it dynamic, so user can enter any positive number.

If the user enters 12, it should run for current month+11 months.

Thanks
Anita

When the user enters 1, it should print the current month and year as well, if the user enters 1, it should print Jul 07 and Aug 07.
 
Set up a number parameter {?addmonth) that has options like this:

Value Description
0 Current Month
1 Current Month + 1
2 Current Month + 2
//etc.

Then you can use a record selection formula like this:

{table.date} in dateserial(year(currentdate),month(currentdate)+{?addmonth}, 1) to dateserial(year(currentdate),month(currentdate)+{?addmonth}+1, 1)-1

-LB
 
Hellow Again!
Thank you so much for this, but I have a question about this parameter,
when I create this parameter, how many values, I need to insert there?

Value Description
0 Current Month
1 Current Month + 1
2 Current Month + 2
//etc.

as I see etc. there, does it mean, it is hard coded.
I would like to make this paramter dynamic, if the user enters 40 as paramter, it should display currentmonth+39 months's data.

Please clarify. thank you again for taking time to explain this.
AA
 
You don't have to have a description field in the paramter selection screen at all. It could just be a box where users respond to the prompt: Add how many months to the current month?

It is unclear to me whether you want the report to run for a range of months starting with the current month, or whether you want the report to run for one month only, which could be described as currentmonth + 39 or month 40.
Please clarify.

You can always then display the parameter selection in the report proper.

-LB
 
Thank you so much for taking time to reply again.
Well, I achieved this by using the field from the view in the report(instead of parameter field).

this is my final formula.

DateVar StartDate := Date(Year(CurrentDate),Month(CurrentDate),1);

DateVar EndDate := Date(DateAdd("m",VW_CR_DC_FLOOR_SPACE_USAGE.MONTH},StartDate)-1);

{table.date} in StartDate to EndDate

it works.
Thanks
AA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top