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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TopN Groups

Status
Not open for further replies.

draganss

Programmer
Jan 13, 2006
47
MK
I'm using CR biult in VS.NET 2002.
SQL 2000

My report is grouped.
I need to show only TopN (10,15,20....)groups based on column SubTotal of the group.

Thank you,
Marin

 
And your question is?

Go to report->group sort->topN->based on: your subtotal.

-LB
 
Thank you LB.
I don't know how I missed such obvious option.

Is it possible to change N in runtime, through VB code?

Marin

 
Yes, it is possible.

Within the report I've predefined TopNSorting(as LB suggested).

Within the code I’ve created simple Sub

Public Sub SpecSta2(ByVal N As Integer, ByVal iTopN As Integer)
Dim topBottomNSortField As TopBottomNSortField
If TypeOf oRpt.DataDefinition.SortFields.Item(iTopN) Is TopBottomNSortField Then
topBottomNSortField = oRpt.DataDefinition.SortFields.Item(iTopN)
topBottomNSortField.NumberOfTopOrBottomNGroups = N
End If
End Sub

where oRpt is ReportDocument
iTopN is index of the SortField
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top