Reputation:
how to find first record from group in crystal reports?
Upvotes: 5
Views: 31538
Reputation: 1
To determine the first subgroup in a group, you can use Previous but this will not show the very first subgroup so use the following:
if GroupNumber = 1 Then
"This is first group in subgroup"
else
if Previous({Group1}) <> {Group1} Then
"This is first group in subgroup"
else
"This is NOT the first group in subgroup"
Upvotes: 0
Reputation: 2715
Previous ({ItemNum}) = ({ItemNum})
This will hide display the first record ItemNum in the group, and hide the rest until the next ItemNum that is different.
Upvotes: 0
Reputation: 17208
When the group header is printed, you're on the first record in the group. Sometimes you can just do the work there.
Upvotes: 0
Reputation: 1
You can use: NthSmallest (1, {yourField},{theGrouping}) Or NthLargest (1, {yourField},{theGrouping})
Works like a charm
Upvotes: 0
Reputation: 2603
You can use the Previous(Group_Field) function in a formula to indicate the start the group. The Online formula function help gives an example. Basically you see if the Previous value of the field you are grouping on is different from the current value. If it is, then you have just started a new group.
If Previous ({table.GroupingField}) = ({table.GroupingField}) Then
False
Else
True
Upvotes: 5