Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help! grouping data in columns Post Reply Post New Topic
Author Message
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Topic: Help! grouping data in columns
     Posted: 06 Mar 2009 at 5:34pm
CryI have a report that displays prices based on weight ranges
 
code   descr     fromunits   uptounits  price
100     item1         1               50           .50
100     item1         51            200          .75
100     item1        201          5000        1.00
 
101     item2          1             100          1.00
101     item2          101         1000        1.50
 
 
the data comes from 2 tables - materials, materialpricing
 
matid   -----  matid
code             fromunits
descr            uptounits
                     price
 
I need to format the report so that the from/to/price columns are grouped horizontally: (up to5 ranges, all different)
 
code descrn      fr/to/price          fr/to/price             fr/to/price
100   item1      1   50   .50        51   200    .75       201   5000 1.00
101   item2      1  100 1.00     101  1000  1.50
 
 
does anyone have any clue where to start??
 
Thanks  in advance
 
Cyber-guys
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Mar 2009 at 6:17am
it the ranges are fixed, you could use a formula that groups on range, but they are not, which makes it harder.
 
is there an identifier in the materialpricing table to tell us the grouping?  Let's say that the lowest group is identified as 1, and the second as 2, and so on.  Then we could create formulae to display only the value based on the ID, and we could place these in a group footer.
 
If there isn't a identifier in the data, and you get the data via a stored proc, you could create one.  My first thought is to get all the data in a temp table, and then to take the MIN value by matid and insert into a 2nd temp table with the ID number (1,2,3...), then delete them from the first temp table.  Repeat until all data in temp table1 is gone.
 
Hope some of this helps
IP IP Logged
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Posted: 09 Mar 2009 at 7:30am
The range values are determined by management with no preset ranges - each material code has 1-5 records to display pricing info - the whole program is an inventory program based on sql express so I don't I have the ability to add a table - I was hoping that the data could be grouped horizontally much like grouping normally works verticallly ie, col1=record1, col2=record2, etc.
 
Thanks
Cyber-guys
IP IP Logged
RitaInHood
Newbie
Newbie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 25
Quote RitaInHood Replybullet Posted: 09 Mar 2009 at 1:28pm
Group by item no, and in header set a variable "columncount" to 0

Upon each new record, columncount:=columncount+1

Create numbervars FromA through FromE, ToA through ToE, etc, and if columncount=1, then FromA:=orig.From, if columncount=2, then FromB:=Orig.From, etc - don't forget to reset values to zero

On the footer record, sum the columns.  Hide the details.

This is code heavy, but should spread the values out on the columns
IP IP Logged
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Posted: 09 Mar 2009 at 6:47pm
Sounds good - I'll give it a try
 
Thanks,
Cyber-guys
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