Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: multiple reasons for single vendor packed in singl Post Reply Post New Topic
Author Message
thy2uday
Newbie
Newbie


Joined: 27 Dec 2011
Location: United States
Online Status: Offline
Posts: 4
Quote thy2uday Replybullet Topic: multiple reasons for single vendor packed in singl
     Posted: 27 Dec 2011 at 5:32am
Hi friends,
                here is my problem...
I have to extract a list of vendors who are not defined as customers with 'reason'. There are multiple reasons for single vedor and all that needs to be placed in a single row.
say example my report has to look like this

Vend1    vendor name    Reason

09090     abcd vend       Reason 1, Reason 2, Reason 3..

actual out put from database is
vend#      vendorname     cond1   cond2  cond3 cond4
1232     abcd                    Y        N          N        Y
1232     abcd                    N        N          N        Y
1234     xyzc                     Y        y          N        Y
1234     xyzc                     Y        N          N        N

Every reason has a condition. And When I try to write a 'formula' for the reason as

StringVar Reason:= '';
if {Command.DHWKAD} = 'Y' then Reason := Reason + ' ,Weekly Ad';
if {Command.DHMCHG} = 'Y' then Reason := Reason + ' ,Set up';
if {Command.DHSSFL} = 'S' then Reason := Reason + ' ,Scan Charge';
if {Command.CLBBAM} = 'Y' then Reason := Reason + ' ,Bill Back';

The out put i get in crystal reports is

vend#      vendorname     REASON
1232     abcd                  R1, R4
1232     abcd                  R4
1234     xyzc                   R1,R2,R4
1234     xyzc                   R1

I am getting multiple records.... I think i should write a loop for each vendor or something. please help me out....it is an emergency

Thanks in advance
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 27 Dec 2011 at 7:43am
Can you group on Vend#, do the calculations in the detail line, suppress the detail line and make the Vend# Group Footer the output?
|< /\ '][' ( )
IP IP Logged
thy2uday
Newbie
Newbie


Joined: 27 Dec 2011
Location: United States
Online Status: Offline
Posts: 4
Quote thy2uday Replybullet Posted: 27 Dec 2011 at 11:11am
Hi thanks for the replay,
                              Now there are no multiple records. But the report is generated only with the final record of the group inspite of taking the aggregation. I used case statement. I feel that if it has to take the aggregation we have to write a loop again.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Dec 2011 at 10:04am
what I see is that the reset, should be in the vendor header, not in the formula.
so in the group header:
shared stringvar Reason := ""
 
in the detail section, your formula would remain pretty much the same
shared stringvar Reason;
if {Command.DHWKAD} = 'Y' then Reason := Reason + ' ,Weekly Ad';
if {Command.DHMCHG} = 'Y' then Reason := Reason + ' ,Set up';
if {Command.DHSSFL} = 'S' then Reason := Reason + ' ,Scan Charge';
if {Command.CLBBAM} = 'Y' then Reason := Reason + ' ,Bill Back';
Since this would be growing, you probably want to suppress the detail section and display the result in the group footer:
shared stringvar Reason;
Reason
 
I believe that someone once said that the Shared was the default behavior, but I like being explicit and leaving as little to CR whim as possible.
 
HTH
IP IP Logged
thy2uday
Newbie
Newbie


Joined: 27 Dec 2011
Location: United States
Online Status: Offline
Posts: 4
Quote thy2uday Replybullet Posted: 28 Dec 2011 at 5:42pm
Thank you for the suggestion...
                 yaa..by moving into group footer the problem is solved.


Thank you guys....Thanks for your time.
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