Documentation

jandoemen - June 12, 2008 - 13:55
Project:Crosstab: Scrolling tables
Version:5.x-1.0
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I installed the module but I don't have a clue how to get something out of it. Can you please tell me where I can find some documentation, hints, an example, ...

Thanks in advance
Jan

#1

Steve Lockwood - June 12, 2008 - 15:05

Hi Jan - I'm afraid the documentation is a bit "light". However, the module itself has quite detailed comments. Basically, there are two functions:
- crosstab_table creates a crosstab analysis from 2 queries: one to define the column headings and another to define the row titles and body data
- scrolling table creates creates a scrolling table from a single query

You will need to look into the code comments to see how the parameters work.

Here is a live example of crosstab_table:

       // query to define the columns
$colq = "
SELECT
CONCAT(category,' ',description) AS t, // column heading
solution_id AS m // match value
FROM {u_solution}
WHERE category IS NULL OR category NOT IN ('category', 'term')
ORDER BY category, description
";
       // query to define the body
$rowq = "
SELECT
CONCAT(t.category,': ',t.description) AS t, // the row title
m.solution_id AS m, // match value
m.value AS v, // data to be displayed in cell
CONCAT('match[',t.trait_id,']') AS x // optional name for the cell
FROM
{u_trait} t
LEFT JOIN {u_matching} m ON t.trait_id=m.trait_id
WHERE t.category IS NULL OR t.category NOT IN ('category', 'term')
ORDER BY t.trait_id
";



$ret .= //
crosstab_table($colq, $rowq, '*');

I hope this helps. If you could give me an example of how your data looks I'd be happy to (try to) work out how it should go.

Steve

 
 

Drupal is a registered trademark of Dries Buytaert.