Sorting in PivotTable


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Sorting in PivotTable

  1. #1
    Join Date
    Feb 2007
    Posts
    1

    Sorting in PivotTable

    Hi All,

    I have tried a number of web sites and forums to sort the data in a PivotTable.

    I have 3 columns namely WebPage,Url and Hits.

    Have to display the column WebPage as the first column, the Pivot sorts the table by the first column by default although the data that is bound to the Pivot is sorted by the last column Hits.

    How do i prevent the default sorting happening in the Pivot or how do I custom sort the Pivot Table by the Hits column.

    I am building the PivotTable purely by vbscript , I cannot do it in the code behind file.

    formname.PivotTable1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Babli\SiteMetrics\sitemetrics.mdb;User Id=;Password=;"

    formname.PivotTable1.CommandText = "SELECT WebPage,Url,Hits from SiteMetricsTable"

    I even tried inserting a total column but didnt work

    Set ptConstants = frmSiteMetrics.PivotTable1.Constants

    Set totNewTotal = vwView.AddTotal("Total Hits", vwView.Fieldsets("Hits").Fields(0), _
    ptConstants.plFunctionSum)

    vwView.DataAxis.InsertTotal totNewTotal

    vwView.RowAxis.Fieldsets("Hits").Fields("Hits").SortDirection = ptConstants.plSortDirectionDescending

    Set vwView.RowAxis.Fieldsets("Hits").Fields("Hits").SortOn = vwView.Totals("Total Hits")


    where TotalHits is the new extra column that I added to try my luck on sorting.

  2. #2
    Join Date
    Dec 2013
    Posts
    24
    Did you get a good solution on this problem? I feel so curious since I am also having the similar one as yours relating to the sorting in pivot grid.

Similar Threads

  1. Sorting
    By Rathi in forum ASP.NET
    Replies: 0
    Last Post: 05-09-2006, 08:01 AM
  2. Replies: 3
    Last Post: 07-29-2005, 11:00 AM
  3. Replies: 1
    Last Post: 04-05-2002, 11:18 AM
  4. Sorting for a JTable
    By Ramkumar in forum Java
    Replies: 1
    Last Post: 01-11-2001, 06:32 AM
  5. CrossBrowser DHTML table sorting problem
    By Joel Matto in forum Web
    Replies: 0
    Last Post: 05-02-2000, 04:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center