Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: concatenate rows Post Reply Post New Topic
Author Message
Darren
Newbie
Newbie
Avatar

Joined: 02 Feb 2009
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Darren Replybullet Topic: concatenate rows
     Posted: 02 Feb 2009 at 1:12am
I am trying to concatenate rows into a group summary using the following formula:
 
Global Stringvar InvNo;
if previousIsNull ({APM_VENDOR.VENDOR_ID}) or ({APM_VENDOR.VENDOR_ID} <> previous({APM_VENDOR.VENDOR_ID})) then
  InvNo := {APT_INVOICE.INVOICE_NUM}
else
  InvNo := InvNo + ", " + {APT_INVOICE.INVOICE_NUM}
 
The formula is in the detail (which will be suppressed) and also the group footer.
 
The formula works very well (it was "borrowed" from an earlier topic) except for the fact that it duplicates the last entry in the group footer, but only if there is more than one entry, as below:
 
 Detail (when not suppressed) 5061123
 Detail (when not suppressed) 5061123, 5061124
 Detail (when not suppressed) 5061123, 5061124, 5062171
 Detail (when not suppressed) 5061123, 5061124, 5062171, 5062172
 
Group Footer: AUD155200 5061123, 5061124, 5062171, 5062172, 5062172
I am not very experienced with Crystal and any help would be gratefully appreciated.
 
Kind Regards,
 
Darren
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 02 Feb 2009 at 2:03am
Hi
 
I  used  the same formula  and changed the variable to shared for details and Group formula and created a new formula called
 
Frm_GroupFooter
 
shared Stringvar InvNo;
if previousIsNull ({APM_VENDOR.VENDOR_ID})  or  ({APM_VENDOR.VENDOR_ID})  <> previous ({APM_VENDOR.VENDOR_ID}) 
 then
  InvNo := {APT_INVOICE.INVOICE_NUM}
else
 InvNo := Invno &  mid({APT_INVOICE.INVOICE_NUM},count({APT_INVOICE.INVOICE_NUM})-1)
 
Hope that works
 
I tested using xtreme database
shared Stringvar InvNo;
if previousIsNull ({Customer.City}) or  ({Customer.City} <> previous({Customer.City})) then
  InvNo := {Customer.City}
else
 InvNo := Invno &  mid({Customer.City},count({Customer.City})-1)
 
Cheers
Rahul
IP IP Logged
Darren
Newbie
Newbie
Avatar

Joined: 02 Feb 2009
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Darren Replybullet Posted: 02 Feb 2009 at 2:52am
Hi Rahul
 
Thanks for getting back to me so quickly.
 
I have substituted your formula for the original one in both the detail and the group footer.
 
The report is now only displaying the first entry for each row (when the detail is not suppressed) and the group footer is only displaying the first entry.
 
Regards,
 
Darren
IP IP Logged
Darren
Newbie
Newbie
Avatar

Joined: 02 Feb 2009
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Darren Replybullet Posted: 02 Feb 2009 at 6:16am
Hi Rahul
 
Thanks for your help. I have managed to get it to work.
 
Your help has been greatly appreciated.
 
Regards,
 
Darren
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 03 Feb 2009 at 7:46am
Great Darren,
 
Please can you post the workaround as how did you manage to get it work,So it might be helpful for other members .....
 
Cheers
Rahul
IP IP Logged
Darren
Newbie
Newbie
Avatar

Joined: 02 Feb 2009
Location: United Kingdom
Online Status: Offline
Posts: 8
Quote Darren Replybullet Posted: 03 Feb 2009 at 8:11am
Hi Rahul
 
I used the following in the detail section (which is then suppressed):

WhilePrintingRecords;
StringVar InvNo;
if previousIsNull ({APM_VENDOR.VENDOR_ID}) or ({APM_VENDOR.VENDOR_ID} <> previous({APM_VENDOR.VENDOR_ID}))
then
InvNo := {APT_INVOICE.INVOICE_NUM}
else
InvNo:= InvNo + ", " + Trim({APT_INVOICE.INVOICE_NUM})


I used the following in the group footer:

WhilePrintingRecords;
StringVar InvNo;


I used the following in the group header:

WhilePrintingRecords;
StringVar InvNo:= ""

Regards,

Darren

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