Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: String data on each row Post Reply Post New Topic
Author Message
Runner
Newbie
Newbie


Joined: 08 Feb 2013
Online Status: Offline
Posts: 22
Quote Runner Replybullet Topic: String data on each row
     Posted: 12 Jun 2013 at 3:45am
I am trying to get one row per phase with multiple cost types, but the result is just the first cost type.  Phases may be set up with all cost types or a select few.  Below is what I am trying to accomplish:
 
Phase 505-451 Cost type 1,2,4,10
Phase 5783-387 Cost type 9
Phase 450-123 Cost type 1,2,3,4,5,6,7,8,9,10
Phase 9999 Cost type 6,8,10
 
I have tried to combine the cost types.  The result is just the first cost type.
 
Thanks.
Runner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2013 at 4:13am
i assume each cost type is a different row of data.
you would have to group on phase and use shared variables to concantenate your cost types across rows then display the final result in the group footer. You can then suppress the GH and detail sections.
IP IP Logged
Runner
Newbie
Newbie


Joined: 08 Feb 2013
Online Status: Offline
Posts: 22
Quote Runner Replybullet Posted: 12 Jun 2013 at 4:19am
Yes.  Each cost type is a different row of data.  Can you please give me an example shared variable?
 
Thanks.
Runner
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Jun 2013 at 4:43am
typically shared variables come as a group of 3 formulas, reset, increment, and display. Let's start with the easiest and go from there.

reset, typically in the group header:
shared stringvar costs := "";

display, typically in the group footer:
shared stringvar costs;
mid(costs, 3) //strips the leading comma off

increment is usually in the detail section and is the most tricky, since it is where the 'work' is done.
shared stringvar costs;
costs := ", " + {table.field} //you might need to convert this field to a string if it is numeric

if you need to convert, totext({table.field}, 0, "") should do the trick.

again as DBlank mentioned, you can suppress the GH and detail section, as the group footer will be displaying the values that you're after.

HTH
IP IP Logged
Runner
Newbie
Newbie


Joined: 08 Feb 2013
Online Status: Offline
Posts: 22
Quote Runner Replybullet Posted: 12 Jun 2013 at 8:10am

I think I may be missing something.  The output is just one cost type per phase on a row.  I do have a Group Header 1 set to Job and Group Header 2 set to phase.  The reset formula is in Group Header 2.

Thanks.
Runner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2013 at 8:13am
reset goes in GH2
incremental formula goes in detail section
display formula goes in GFooter2


Edited by DBlank - 12 Jun 2013 at 8:13am
IP IP Logged
Runner
Newbie
Newbie


Joined: 08 Feb 2013
Online Status: Offline
Posts: 22
Quote Runner Replybullet Posted: 12 Jun 2013 at 8:25am
That is exactly how I have the formulas and the report is still one cost type per phase.  I have the incremental set up as: shared stringvar costs;
costs :=  ", " + ToText({JCCT.CostType},0,"")
 
Output: 50-3456      CT 9
           50-2000       CT 10
They should have 50-3456       4,5,6,9,10
 
Thank you.
Runner
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Jun 2013 at 8:28am
doh...
should be...
costs:= costs + ", " + ToText({JCCT.CostType},0,"")

I hate when I make bone head mistakes like that...
HTH

Edited by lockwelle - 12 Jun 2013 at 8:28am
IP IP Logged
Runner
Newbie
Newbie


Joined: 08 Feb 2013
Online Status: Offline
Posts: 22
Quote Runner Replybullet Posted: 12 Jun 2013 at 8:39am
AWESOME!!!!!  It worked.
 
Thank you for all of your help.
Runner
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