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!

How to modify the groupoptions of a date in a crosstab

Status
Not open for further replies.

Jebarcha

Programmer
Jul 11, 2001
4
0
0
MX
Hi! Does anyone know if its possible to change the group options of a date in a crosstab,manually by vb code?
This is because i want to show the columns in differents formats for example by week, biweek, monthly, annualy, etc. so i want to avoid to make a lots of rpt files, I want to use only one and only change the property.
I tried something like:
Dim rrep As CRAXDRT.CrossTabGroup
rrep.Condition = crGCAnnually
but it produces an error (obj or var not set).

Thanks
 
I don't know how to do this in vb, but you could do this within CR in the following way. Create a string parameter
{?date group interval} with defaults: daily, weekly, biweekly, monthly, annually. Then create a formula {@dategroup}:

if {?date group intervals} = "daily" then
date({table.date}) else
if {?date group intervals} = "weekly" then
date(dateadd("ww",datepart("ww",{table.date})-1,date(year({table.date}),01,01)
-dayofweek(date(year({table.date}),01,01))+1)) else
if {?date group intervals} = "biweekly" then
(if remainder(datepart("ww",{table.date}),2) = 0 then
date(dateadd("ww",datepart("ww",{table.date})-2,date(year({table.date}),01,01)
-dayofweek(date(year({table.date}),01,01))+1)) else
date(dateadd("ww",datepart("ww",{table.date})-1,date(year({table.date}),01,01)
-dayofweek(date(year({table.date}),01,01))+1))) else
if {?date group intervals} = "monthly" then
date(year({table.date}),month({table.date}),01) else
if {?date group intervals} = "annually" then
date(year({table.date}),01,01)

Use this formula as your column field in the crosstab.

-LB
 
LB, Thank you for your help! I tried as you said and it works very well.
Regards jebarcha.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top