Drupal Association members fund grants that make connections all over the world.
Concatenates multiple (table) views together into one table.
This module is frankly disgusting,
It revolves around the following piece of code
$html=preg_replace("/(((?>[^<]+)|(<(?!table\b[^>]*>)))+)|(<table\b[^>]*>((?:(?>[^<]+)|<(?!table\b[^>]*>))*?)<\/table>)/sx","<tr class=views_of_views_other><td class=view_of_views_other colspan=0>$1</td></tr>$5",$html);
However, the end result is helpful. Imagine you wish to have an editable spreadsheet, with some fields "calculated".... here's how.
Lets take a simple example: We want to build a shopping list:
apples : €2
1) Create a content type for the shopping list. ("List") We'll be adding things to this later.
2) Create a content type for the lines in your shopping list. ("items")
On "items", we need 3 fields: The description, the price, and a node reference to the shopping list (List)
you may like to add some test data now!
3) Now, create a simple view (itemprice), which lists out the prices for all the items, which has a specific node reference (put node reference as an argument). Call this totalview.
4) Now add a content type to your shopping list that is a computed field - you will need the module computed_field you will also need to follow the example here:
/node/180013. Add a computation that calculates the total you want, using your nice view.
Note, this is the HUGE power here - you can make any calculation you like, and using views, it can be complex
5) Now create another view (itemlist), this time, make it an editableview - you will need editablefields. Just like last time, this view should list all items associated with a shopping list, which should be provided as an argument. Only this time, why dont you filter out items with a price =0, and you could make the price and description editable... (go check the view is working - remember to give it the argument of a shopping list node)
6) Time for another view (thistotal). This time, set up a view to select the "total" field (that you set up in 4), on nodes that have a node ID that you supply as an argument - just select node ID as an argument. In essence, this is a view of a computed field.
this is the basic mechanism here - set up a view of a computed field
7) One more view? -- Create one more view (shoppinglistview) with the view_of_views module.
For this one, use the view_of_views table type, and then add a filter, using the view_of_view selector, one per view that you want included. Use one view per filter (though you could select more) - so that you can re-organize them as you would like them to appear.
MAKE SURE YOU ADD AN ARGUMENT TO THE VIEW
(your sub-views take an argument, so, so should your view of views. in this case, it does not matter what argument you choose, so long as you indicate that there will be one - i.e. node ID)
8) Now it's time to put the final touches on:
Now you would like to see this list on your shopping list node, so add a viewfield
viewfield. Things to note - you better set the default view when you set up the content, and also, we need this patch/node/165321 (We need this because we are using a view field to view a view of a field on this page - anyway we do! - if you dont want to apply the patch, then the "total" computed field has to be moved to some other page - with a node reference etc - you can do it if you want).
Bingo - you should end up with a shopping list.
You can now add other fields to your items, some of which could be calculated (like unit price * number), and you could add other rows, like total, tax, total including tax. In this case, you add more computed fields, and one more view per row, and then you add these to your overall shopping list view.
Some bad things to note - the computed field runs the view in the display code - otherwise it wont update when a node that is not this node is updated. If you want to make a calculation based on a calculated field, you need to re-calculate it all.
- Maintenance status: Unknown
- Development status: Unknown
- Module categories: Views
- Downloads: 1,962
- Last modified: December 2, 2014
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.