Tuesday, March 22, 2011

Crystal Reports : Changing Groups at Run-Time

This is neat: Let us suppose we want a report to be Grouped on either Users.UserID or Users.UserTerritory, depending on a Parameter field.

So, provide a simple parameter, {?Group} and let the user set it to "UserID" or "Territory".

Now, within your report, create a formula field called {@Group1} and paste in the following code:

IF {?Group} = "UserID" THEN {USERS.USERID} ELSE
IF {?Group} = "Territory" THEN {USERS.USERTERRITORY}

Now, create your Group in crystal, and use {@Group1} as your Group Field.

This way, the user can select how the report should group itself, affecting all summaries, etc.

Try it!

3 comments:

Anonymous said...

tnx man... this one saved me... i'm new to crystal reports so i didn't know that it's possible to make a formula on which field i want to sort... i was having a problem about it and was browsing the net for 6hrs to find a solution on my problem... i'm glad i found your blog... thnx... your a life saver...

pete

Zheng junxai5 said...

zhengjx20160623
louis vuitton bags
retro 11
coach outlet
montblanc pens
asics shoes for men
louis vuitton outlet stores
louis vuitton handbags
celine outlet
louis vuitton purses
timberlands
coach factory outlet online
tory burch shoes
nike sb janoski
oakley outlet
kate spade handbags
coach factory outlet
cheap jerseys
coach outlet store online clearances
true religion outlet
michael kors outlet online sale
coach outlet
louis vuitton handbags
ray ban sunglasses
air jordan shoes
michael kors outlet clearance
nfl jerseys
coach outlet online
ray ban sunglasses
ralph lauren outlet
louboutin femme
toms shoes outlet online
coach factory outlet
juicy couture
toms wedges
oakley outlet
cheap louis vuitton handbags
timberland boots
christian louboutin shoes
coach outlet online
nike free 5.0

Fangyaya said...

ugg boots
polo outlet
ray ban outlet
true religion outlet
ugg uk
cheap air jordans
adidas stan smith
coach factory outlet
uggs on sale
adidas trainers
michael kors outlet online
christian louboutin pas cher
nike air max pas cher
ray ban sunglasses outlet
fitflops sale
nike air max uk
red bottom shoes
michael kors outlet
uggs outlet
ralph lauren clearance
tory burch shoes
ralph lauren
toms shoes
cleveland cavaliers jerseys
adidas yeezy
louis vuitton purses
adidas outlet store
christian louboutin outlet
nhl jerseys
ugg boots
cheap rolex watches
hermes birkin handbags
michael kors purses
cheap louis vuitton handbags
nba jerseys
ugg outlet
toms shoes outlet
uggs on sale
replica rolex watches
cheap uggs
20168.13chenjinyan