Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: specify different set of code to run via parameter Post Reply Post New Topic
Author Message
wdelaney
Newbie
Newbie


Joined: 06 Jun 2011
Location: United States
Online Status: Offline
Posts: 2
Quote wdelaney Replybullet Topic: specify different set of code to run via parameter
     Posted: 06 Jun 2011 at 5:12pm
Hi,
I'd like to do something like this in Crystal Reports in my command object:

declare RecDisplay INT:= {?RecordDisplay};

IF RecDisplay= 1 THEN
..code to run rpt with columns having aggregrates
ELSE
..code to run rpt with columns (very same columns) without aggregates
END IF

Is it possible to do that?

Edited by wdelaney - 06 Jun 2011 at 5:28pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 Jun 2011 at 3:19am
I am going to say yes.
 
Potentially it is a lot work, but I don't see why you couldn't accomplish the task.  I am guessing that running totals and/or shared variables will become close friends.
IP IP Logged
wdelaney
Newbie
Newbie


Joined: 06 Jun 2011
Location: United States
Online Status: Offline
Posts: 2
Quote wdelaney Replybullet Posted: 07 Jun 2011 at 5:30pm
ok, here's what worked: I used two SELECTS in the one command object, one with the GROUP BY and one without, and did the parameter differently  in the WHERE for each, so that only one of the SELECT's actually produces any rows. 
For the SELECT with the GROUP BY, I added {?RecordDisplay} = 1 to the WHERE.  For the other SELECT, I added {?RecordDisplay} <> 1 to the WHERE.
I used UNION between the two SELECTs and rows returned for whichever SELECT's WHERE clause happened to meet the criteria for the parameter input.


Edited by wdelaney - 07 Jun 2011 at 5:31pm
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum