Project:Views Union
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hiya,

I wrote a module that performs a similar function for Drupal 6. I was going to create a new module when I realised there was this existing Drupal 5 module ! It's not a port of this module, it's a re-implementation but since it performs the same function, it might not make sense to create a new module.

The module works by creating a Views filter, which lets you select any number of existing node views, and then only return nodes that are in one of those views. (It is also possible to ask it to return nodes that are in none of those views).

Internally, it works by running the query of the other views in temporary tables, and then joining those tables to the main query. This appeared simpler than trying to merge all the queries together !

The queries creating the temporary table are run during hook_views_query_substitutions. It works perfectly fine, though obviously this hook wasn't meant for this ; I will look for a cleaner solution in the next versions.

So - does it make sense to merge those projects, or do you think I should create a separte module ? The module is attached btw - it's called 'merge_views' at the moment !

AttachmentSize
merge_views.tgz1.73 KB

Comments

#1

+1 for this functionality in D6

I can't seem to get this mod to work with the latest version of views 2. Does it still?

I assume views_union is going to upgrade to D6, but since Views hasn't stabilized yet, it has yet to get a release date.

txcrew

#2

Hi txcrew,

Attached is the version of merge_views which works with Views post RC2 (didn't test it with RC3, but I don't think there was any major changes between RC2 and RC3).

I posted this issue here three months ago, and didn't get any feedback from the developers so I guess I will make merge_views into it's own module at some point. Feel free to use this version in the mean time ; but note that at this point there is no guarantee this will be maintained in the future.

Anselm

AttachmentSize
merge_views-6.x-1.dev_.tgz 1.84 KB

#3

Hi Anselm,

Great module! Very simple to use. I understand this module is currently 'unmaintained' and cannot really be supported and this is not the time or place for questions about it, but I cannot help myself....does this only work with views that are node types (not comments, files, etc.)?

thanks!!

txcrew

#4

Yes, it only works with nodes. It shouldn't be too much work to adapt it to other content types ; though I won't have time to look at that myself for a while.

#5

I need to put 2 taxonomy views together, I hope somebody can port this to d6 with terms enabled.

#6

@Miraploy : You can use the Views Or module to do this. Views Or will be deprecated when the feature gets into Views proper ; but in the mean time it's the only options for D6.

You can also use the views_merge module I posted above - but I would recommend using Views Or instead (I will maintain Views Or ; while I won't maintain the module I posted above).

#7

Thank you Anselm Heaton, I thought about using the Views Or before, but the message about it being deprecated scared me. But to see your reply means I can use it confidently. Thank you.

#8

+1 subscribing

#9

is there any update when views union will be updated for D6?

seeing there has been little activity on this thread if I were you I'd start a new project for merge views.

#10

Subscribing - is there any plans to include D6? I don't see how http://drupal.org/project/views_or does the same thing.

#11

I too would like to see Anselm's module committed for the D6 version.

#12

+1

#13

pretty familiar with Views_OR.. pretty sure it can't do what this module does.

#14

ok.. well my bad.. for my particular case.. i couldn't get the merge module here to work.. BUT actually did get Views_OR to work.. go figure

my use case:

i have a node called team with 2 userref fields, captain and cocaptain

simply trying to make a list of all captains and cocaptains... 1 per row.. not both on same line. need these one per since i am using the views_send module (extension to VBO to send mass emails) to list each of these users on a separate line so i can send each of them an email.

recipe:

- a user view (tried node view with merge module here but not only did it not do the merge but listing teams will list user multiple times if they are captain of multiple teams) - user view does distinct on the user if its a user view

- make 2 relationships - one for captain and one for cocaptain fields

- filter on captain field not being null OR cocaptain field not being null

really doesn't make any sense to me.. but it does seem to be working.

the Views_Union or merge use seems intuitively more obvious to me.. but it doesn't seem to be working.

#15

Hey all.. Just to let you know, I posted a new project Views_Unionize that I needed implemented for a recent site. It's still listed in sandbox at the moment, but if you'd like to have a peek, it's here:
http://drupal.org/sandbox/tsimms/1101912
What I really need to do is to spend some time on the documentation and example use cases.

Once you install the module, you'll have a new display type within views, called "Union". You choose 2 or more displays in the same view that you'd like to union together. Special attention should be given to ensure you have the same number of database fields in your child displays, otherwise you'll get a database UNION error. Keep in mind, not every view field constitutes a database field, so you may have some trial-and-error here. After that, define some fields in the union display (you should only reference fields that exist in the child fields of course; otherwise, you'll get errors stating the field you chose cannot be found). Finally, you can format the data using fields, sort, filter, or any of the output options on the union display.

The main use case we solved with this module was that we had view displays that had distinct relationships based on node references, but we wanted the results to be sorted by title (which of course existed in the different content types we were using) all merged together.

Anyhow, hope this is helpful.

Thanks,
-Tim

#16

It would be great if people in this thread could test out tsimms module and confirm whether it meets their need.

#17

Can I safely try this out on a live site? Does it make any changes to the database on install?

Thanks!

#18

subscribe