PIVOT/Cross table - example needed

Status
Not open for further replies.

brian

Member
Hello keen reader,
I know i have been going on about this for a little while now and i do apologies for harping on. I am trying to use the pivot list plugin and i'm having no success. Really at this stage i just would like someone to assist with weather or not it can do what i want it to do for my data set. Alternatively ill have to code one myself.:confused::oops:
I have a table, it consists of records for users in different offers,

ID|USER|OFFER|
1 | 235 | black
2 | 235 | black
3 | 235 | blue
4 | 235 | green
5 | 235 | black
6 | 236 | red
7 | 236 | black

I want to display like this

USER| BLACK| BLUE | GREEN | RED
235 | 3 |1 | 1 | 0
236 | 1 | 0 |0 |1


If i can get this working i will share all the details and do a write up for the pivot list plugin page .
 
OK, I just set up a test case, pretty much same as yours, with user and "color".

The only non-intuitive thing I had to do was create an unused "num" field, which I default to 1, and hide in the form. I use that for the "Sum / count". Set the X Axis to User, Y Axis to Color, and the group-by two those two element names (fab_pivot_test___color,fab_pivot_test___user_id).

And that works. I get usernames along the top, color names down the left, and the totals are correct.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top