×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to modify the groupoptions of a date in a crosstab

How to modify the groupoptions of a date in a crosstab

How to modify the groupoptions of a date in a crosstab

(OP)
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

RE: How to modify the groupoptions of a date in a crosstab

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

RE: How to modify the groupoptions of a date in a crosstab

(OP)
LB, Thank you for your help! I tried as you said and it works very well.
Regards jebarcha.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close