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

Parameter like Calendar3rdQtr

Status
Not open for further replies.

5lights

MIS
Nov 19, 2003
53
US
I want to create a parameter in CR8.5 that allows the User to select which Quarter(daterange)...can I use a Function like 'Calendar3rdQtr'?
 
Also, I'm looking to determine how many days(ie Mondays)
in the parameter (daterange of Calendar3rdQtr)
 
You could create a numeric parameter called {?quarter} with values of 1, 2 ,3 and 4. Create descriptions for these values and show only the descriptions.
In your Record Selection Formula you'd have something like this:
Code:
{Orders.Order Date} in [Calendar1stQtr,Calendar2ndQtr,Calendar3rdQtr,Calendar4thQtr][{?quarter}]

Bob Suruncle
 
I think that will work, but I'm messing up syntax somewhere....not sure I understand use of two subscripted arrays(ie [][]).
 
hope this helps

To display and group records from the current and previous quarter, complete the following steps:

1) On the 'Insert' menu, click 'Parameter'. Create two numeric parameter and name them 'Quarter' and 'Year'.

2) On the 'Report' menu, click 'Edit Selection Formula', then 'Record'.

In the 'Record Selection Formula Editor', enter the following text:

numbervar q:= tonumber({?Quarter});
numbervar y:= tonumber({?Year});

if {?Quarter} = "1"
then date(y-1,10,01) <= {Table. date field}
and date(y, 03, 31) >= {Table. date field}

else if {?Quarter} = "2" then {Table. date field} in date(y, 01, 01) to date(y, 06, 30)
else if {?Quarter} = "3" then {Table. date field} in date(y, 04, 01) to date(y, 09, 30)
else if {?Quarter} = "4" then {Table. date field} in date(y, 07, 01) to date(y, 12, 31)

// Replace {Table. date field} with your own date field.

3) On the 'Insert' menu, click 'Group'. Select your date field and set the grouping 'for each quarter'.

4) When you run the report, enter a single digit value for the 'Quarter' parameter and a four digit value for the 'Year' parameter.

If you are using CR 8 or higher, you can write a formula similar to the following. The advantage of this formula is that it allows processing to occur on the server rather than the client machine. This speeds processing of the report.

//The DateAdd function allows this
//formula to process on the server.
{Table. date field} >= Date(DateAdd("q", ToNumber({?Quarter})-2, Date(ToNumber({?Year}),01,01)))
and
{Table. date field} < Date(DateAdd("q", ToNumber({?Quarter}), Date(ToNumber({?Year}),01,01)))
 
Thanks.
That'll do it.
I ended up changing to "Fiscal Month" & "Fiscal Year",
to give them more flexability than Quarters...


numbervar s:= Minimum({?Month});
numbervar e:= Maximum({?Month});
numbervar y:= tonumber({?Year});

{PRE_CASE.START_DATE} in Date(DateAdd("m", (s), Date((y),01,01))) to Date(DateAdd("m", (e), Date((y),01,31)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top