Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Creating a concatenated String Post Reply Post New Topic
Author Message
zyberjock
Newbie
Newbie
Avatar

Joined: 13 Jul 2008
Location: Philippines
Online Status: Offline
Posts: 3
Quote zyberjock Replybullet Topic: Creating a concatenated String
    Posted: 13 Jul 2008 at 7:28pm
i have data with this display format as displayed by cr9
From     TimeTo       Day

8:00     10:00         M
8:00     10:00         W
9:00     11:00         F


and what would i do so that it would end up like this
From     TimeTo      Day

8:00     10:00        MW
9:00     11:00        F

Thanks and more power


Edited by zyberjock - 13 Jul 2008 at 9:27pm
IP IP Logged
zyberjock
Newbie
Newbie
Avatar

Joined: 13 Jul 2008
Location: Philippines
Online Status: Offline
Posts: 3
Quote zyberjock Replybullet Posted: 13 Jul 2008 at 9:28pm
is there a way to do that???Cry
IP IP Logged
venkatesha
Newbie
Newbie


Joined: 29 Jun 2008
Online Status: Offline
Posts: 35
Quote venkatesha Replybullet Posted: 13 Jul 2008 at 10:46pm
Create  groups for From and Time To. Place these group name in Group 2 Footer.

Create three formulas   
     1.  DeclareField  formula
       WhilePrintingRecords;
        stringVar str:="";
     Place the same in Group 1 header.
   
    2. ConcatenateField formula  the field in the detail section by using the formula

           WhilePrintingRecords;
            stringVar str;
            str:=str+ {Sheet5_.Day};
    
   3.  DisplayDay formula Place the field in Group2

    WhilePrintingRecords;
    stringVar str;
     str;
IP IP Logged
zyberjock
Newbie
Newbie
Avatar

Joined: 13 Jul 2008
Location: Philippines
Online Status: Offline
Posts: 3
Quote zyberjock Replybullet Posted: 14 Jul 2008 at 5:38pm
thanks it's working fine now Clap
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 20 Aug 2008 at 5:05pm

To continue on with this same scenario... What if your data was

From     TimeTo       Day

8:00     10:00         M
8:00     10:00         M
8:00     10:00         M
8:00     10:00         W
9:00     11:00         F
How would you stop the report from duplicating the three M's like below?:
 
8:00     10:00      MMMW
9:00     11:00      F
 
I have been trying to figure this out for awhile!!Confused
 
Thanks for your help!
minnie_eye
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 20 Aug 2008 at 5:23pm
You can do one of two things. The first is use the PreviousValue() function to see if the current value equals the previous value, and if so then don't do the concatenation. The other option is to see if the last character in the string doesn't match the current value and then do the concatenation. use the same code in the previous post, but add a condtional statement before it.
 
option 1:
if {Sheet5_.Day} <> PreviousValue({Sheet5_.Day}) Then
    str:=str+ {Sheet5_.Day};
option 2:
if Right(str,1) <> {Sheet5_.Day} then
    str:=str+ {Sheet5_.Day};

 

I have all the Crystal syntax formulas and sample code for how to use them in three chapters of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.


Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 21 Aug 2008 at 7:42am
That eliminated most of my duplicates.  But there is one more complication.  If the data is listed as below:
8:00     10:00         M
8:00     10:00         M
8:00     10:00         M
8:00     10:00         W
8:00     10:00         M
8:00     10:00         W
9:00     11:00         F
How would you stop it from showing:
 
8:00      10:00       MWMW
9:00      11:00       F
 
Since the comparison is to the immediate previous field it will still duplicate.
Thanks!!
minnie_eye
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.