Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reporting Grouping not working?

Status
Not open for further replies.

meg25

Technical User
Apr 15, 2002
8
0
0
SG
Can anyone tell me how grouping will cause crystal report to evaluate the output? I have currently grouped my details section to arrange their ordering. By right, the output display should be separate between groups.. but somehow, the output is mixed and interferring with each other.

Is there a way to separate the formulas that I've written for the groups? They don't seem to be separate within each group.

Thks.
 
hi,

can u explain u r problem ...rather try putting some illustrative example.
 
okay, i think the problem lies with this. i need to process the records in the tables before displaying them. i have a table which contains four records, of which only one of them is relevant.

i need to read this record and then display the output in the details/group header/group footer section. but as it is, the formula will always go through all the records and each time, the result is overwriting the previous one.

let's say the record i have is such
row 1: "sunday" "7" "green"
row 2: "monday" "1" "yellow"
row 3: "wednesday" "3" "red"

i need to check if first element = monday, output "yellow". but the formula runs through all the rows and the final output is null as the last record is wednesday (and therefore fails the if-statement)

is there anyway to prevent this and get my formula to not overwrite?
 
there's a big difference between grouping and sorting, are you doing any sorting within your groups?

lmc
cryerlisa@hotmail.com
 
no.. i am not doing any sorting.. or so i hope i haven't done so...

basically, i have 4 groups. of which each has one or more records in the dataset table. each time the formula calls the dataset from the group header, the formula accesses all 4 records. and for each record, the formula is executed once, in the same group.

is this correct? i'm really trying to understand how crystal report handles formulas.

i have found a way to get past my problem.. (though not tested that it's working).. i have found out of "redim preserve" that preserve the array so that the array isn't created over each time a new record is accessed.

but i still don't understand the way crystal report access and prints out the results. can anyone give me an insight?

thks.
 
Why are you using an array? Please tell me what OUTPUT you want to generate from the report, and I am sure we can help. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
okay... hope this won't turn into a long essay. :p

dataset:
type value serial
---- ----- ------

1 5 1
2 10 1
3 15 3
4 20 3

so my formula just wants to check the type by group. let's say i have two groups. for the first group, i'm only interested in type 1 and 2. for the second group, i'm interested in type 3 and 4. if it corresponds, i will put the value into the corresponding element. eg.

list.number is the criteria for my groups.

if serial = list.number then ( //to determine relevant record
if type = serial or type = serial+1 then (
array[type] := value;
);
);

seems correct right?

by look of the code, i should get in my report:
for group1 : [5, 10, 0, 0]
for group2 : [0, 0, 15, 20]
right? but it's not. somehow, for both groups, the array is the same
[5, 10, 15, 20]

why? how come the first if-statement doesn't seem to filter out the records that doesn't belong to the group?
 
I have no idea what you are trying to accomplish with this formula, and I have no idea what List.number is. However, one part of your formula:

if type = serial or type = serial+1 then ...

evaluates to TRUE for every single record, which is why you are getting all 4 values.

You are talking about a group for types 1 and 2, and another for types 3 and 4. What do you want to do with these groups? no formulas please, just tell me what values need to be subtotaled, displayed, etc. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
thanks for replying.

the above is not my original formula. i'm just outlining the main crux of the problem. i wish to group. so say, there are many records in my dataset. some for year 2000 and some for year 1999. so i'm expecting the group for 1999 to only use the 1999 records to evaluate my formulas, and likewise for 2000. however, the values are all executed and displayed together. such that both my groups have the same values, instead of separate.

my assumption was that crystal report will evaluate the formulas group by group. rather than altogether the whole report, then display them out in groups. is my assumption wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top