This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

What data type ie collection or logic to be used for data?

 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


I have a pivot and my pivotTableModel holds data in this fashion...
eg I have a data containing task,Year and month field values


The struture of my PivotTableModel. Below the data is being show in PivotTableModel rows...
it has theses fields
Task         Year Month Values

Issued check                7 => Total checks issued
               2010            4 => Total issued in 2010
                      Feb       3 ==> in Feb, 2011
                      Mar       1 ==> no of checks issued in Mar 2011
               2011            3 ==> Total in 2011
                      Dec       3 == > issued in Dec, 2011


Now I have to show this pivot table

                         2011      2010   Total
Task                   Feb Mar  Dec
Issued Checks      3    1     3         7



How to go about it?

I have a logic which tells me that user has asked for one (or more ) columns on the left and one or more columns on the top

I am havng success to show and also sort values of the left ie values of the task. but the values on the top. If single set of values I am to show. no problem, it is sorting too. but when I have more than that on the top, the top header values stop sorting and also the values against them in the table are not getting put correctly.

Thank you,

Maki Jav
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone there to help me with this? What path should I take?
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main problem could be that

There can be more than one Feb 2011 occuring against tasks that I have not shown. So I need to merge all occurences and show as one Feb 2011 on the x-axis and show other tasks as occuring against it...



Anyone with a suggestion to the problem?
 
Ranch Hand
Posts: 160
IntelliJ IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's pretty difficult to understand your question as it is.

Can you post a SSCCE?
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the model with real data from database...

 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And I need to pivot it with the structure


Total
2011 2010
Feb Mar Dec
Task 100 (including other tasks)
Issued Checks 3 1 3 7




        Year         Total
        Month
name                value

please see table I constructed in the first post...

Sorry I could not post the table perfectly. It is ugly...


Thanks,

Maki Jav

 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have shortened the data. When you run example, you will see that the System.out.println() statements correctly indicates what data is being picked. I have added one more column "Date". User may decide to chose 3 or even more headers on the top of pivot table!

The end result I want is

List columnTopHeader or even if we take that out, List data be filled with such Vectors or HashMaps/Hashtables that reflect our data

eg
List data/ or columnTopHeader ---
         + --- Year (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
         + --- Year (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                               +--- Date (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)
                               +--- Date (Vectors/ or other collection)
                               +--- Date (Vectors/ or other collection)
                    +--- Month (Vectors/ or other collection)

or more vectors//collections within vectors/collections as per data requirement.

And in the end I would arrange them

as per user choice after merging similar values... eg for the various names we will have 2011 and also March
so that we will have one 2011 and March in the headers and various names are "ticked" against that

                                                     2011
                                                         March  April
name

BALANCE CONFIRMATION PROCESS        10
.....
.....
CENTRAL BANK ORDER PROCESS            105



The above example shows only a part of table.

 
Let's go to the waterfront with this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic