Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Rows to Columns Post Reply Post New Topic
Author Message
cirvine2
Newbie
Newbie
Avatar

Joined: 16 Apr 2009
Location: United States
Online Status: Offline
Posts: 5
Quote cirvine2 Replybullet Topic: Rows to Columns
     Posted: 16 Apr 2009 at 4:50pm
Hi everybody,
I'm new using crystal. I'm doing a report , maybe is something very simple, but for now, I'm stuck.
I have an Access database, I made a query in access from 5 tables with all the output fields that I need. So in crystal I just open this query.
This is my query:
Part#    Description  sequence   process_code
123       Chair            0                S01
123       Chair            1                M02
123       Chair            2                M50
123       Chair            3                F01
123       Chair            4                M02
144       Table            0                S01
144       Table            1                A03
144       Table            2                Q01
152       Desk             0                F01
152       Desk             1                A03
152       Desk             2                Q01
152       Desk             3                S03
152       Desk             4                M01
The following is the report that I need. Add line#, group by part# and the process_code column in a row for each group
Ln#        Part#    Description      
 1            123       Chair                    S01     M02     M50     F01     M02
 2            144       Table                    S01     A03     Q01    
 3            152       Desk                     F01     A03     Q01     S03     M01
Please help!


IP IP Logged
achaithanya
Newbie
Newbie
Avatar

Joined: 19 Jul 2007
Location: India
Online Status: Offline
Posts: 10
Quote achaithanya Replybullet Posted: 17 Apr 2009 at 6:32am
Hi Cirvine,
 
You can try this Option. I guess this might work for u.
Follow these steps and let me know.
 
1. Group your report based on Description.
2. Go to Report Section Expert--> Click on Group Header#1(which ur header).
3. On your left side in common tab you have  check this option Underlay Following Sections.
4. Now Select Details on your left pane.
3. Right side to this in Common tab you have Format with Multiple columns check this option.
4. You will find one more tab extra called Layout.
5. Click on Layout tab In Printing Description select Across then Down.
6. Mention the Detail size width  and Gap between details.(I'm not sure about the exact width. You play around by changing these values).
 
I hope you will be able to display the data as per your requirement.
 
Thumbs%20Up
 
Akki
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Apr 2009 at 6:48am
I would do this in a different way, using shared variables.
 
Group by the Part#.  There are going to be several formulas that you will need to create. 
1) LineNumber:
shared numbervar lineNumber :=0;
""  //hides a 0 floating on the report
 
2) ResetDesc:
shared numbervar lineNumber := lineNumber + 1;
shared stringvar Desc := ""
 
3) DisplayDesc:
shared stringvar Desc
 
4) AddDesc:
shared stringvar Desc := Desc + {table.process_code}
""  // hides the desc (optional)
 
the first formula can go in the report header, as it is only initializing the line count variable.
 
The second formula would go in the group header, and this line would be suppressed
 
The third formula goes in the group footer, which is the only section displayed
 
the last formula goes in the details section of the report, and I would supress the details section.
 
That's pretty much it, like you said, a simple report.  You might want to play with the spacing of the items as you add them to the Desc variable.
 
HTH
 
 
IP IP Logged
cirvine2
Newbie
Newbie
Avatar

Joined: 16 Apr 2009
Location: United States
Online Status: Offline
Posts: 5
Quote cirvine2 Replybullet Posted: 17 Apr 2009 at 12:28pm
I have tried both suggestion I got.
But with your option I cannot put the 3 first columns inside the report. I just got the code_process columns. And there is no way I can add the ln#, part# and description. I have made a supreport, with the other columns, but I do not get the following output.
Ln#        Part#    Description      
 1            123       Chair                    S01     M02     M50     F01     M02
 2            144       Table                    S01     A03     Q01    
 3            152       Desk                     F01     A03     Q01     S03     M01
Also I got a new requirement.  Each code_process has a status if status = true I have to color the background of text in green, is this hard?. These are the original data
Part#    Description  sequence   process_code    status
123       Chair            0                S01                       1
123       Chair            1                M02                       0
123       Chair            2                M50                       1
123       Chair            3                F01                        0
123       Chair            4                M02                       1
144       Table            0                S01                       1
144       Table            1                A03                       1
144       Table            2                Q01                      0
152       Desk             0                F01                       1

IP IP Logged
cirvine2
Newbie
Newbie
Avatar

Joined: 16 Apr 2009
Location: United States
Online Status: Offline
Posts: 5
Quote cirvine2 Replybullet Posted: 17 Apr 2009 at 12:29pm
HTH,
Thanks, is working fine.

But I got a new requirement.  Each code_process has a status if status = true I have to color the background of text in green, is this hard?. These are the original data
Part#    Description  sequence   process_code    status
123       Chair            0                S01                       1
123       Chair            1                M02                       0
123       Chair            2                M50                       1
123       Chair            3                F01                        0
123       Chair            4                M02                       1
144       Table            0                S01                       1
144       Table            1                A03                       1
144       Table            2                Q01                      0
152       Desk             0                F01                       1

thank you
cc
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Apr 2009 at 1:08pm
forgot a formula, displayLine:
shared numbervar lineNumber
 
once every is set, in the group footer, you put the formula displayLine, the field description, and the part #, so all of the data should be displayed in the summary group.
 
The status is a more complex issue.  in a formula, it is a all or nothing, so you would need to create 2 strings, one that will be green and the other that is not, then you would need to display them...I would probably create a text field and put the green string formula in it and set the color, and then put the formula to display the non green in the same text box, but without the coloring.
 
It should work.  You will want to modify the 2nd formula to reset the string, an the 4th formula that goes in details to put the code in the correct variable, and finally you would need to create another formula to display the 'new' string.
 
Hope this helps
IP IP Logged
cirvine2
Newbie
Newbie
Avatar

Joined: 16 Apr 2009
Location: United States
Online Status: Offline
Posts: 5
Quote cirvine2 Replybullet Posted: 17 Apr 2009 at 4:07pm
HTH,
I create text object to display the results. I created two temporal formulas, one for color value and the other for no color.
Question is, how to put both formulas in the same text box?.
thanks
cc
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 20 Apr 2009 at 6:18am

you'll laugh...just drag them.  You will see the cursor move to the end of the first formula and you can drop the second formula right behind it.

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