Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2011 at 21:17 UTC
Updated:
3 Sep 2014 at 06:46 UTC
Jump to comment: Most recent
Comments
Comment #1
merlinofchaos commentedYou could use hook_views_pre_render(), run execute an alternative display (recommend an attachment that is not actually attached to anything), then merge (and sort!) the $view->result setup. They would have to have exactly the same fields.
You could probably also do something really whacky by creating a view style, as well, that could run an attachment and attempt to sort in the rows. Doing it that way would probably not require anything about the two views being the same, so long as they're using row plugins, but you'll still have to somehow sort the result rows.
Comment #2
merlinofchaos commentedA third alternative might be to run two views that just returns node IDs, then set all those node IDs as an argument to a 3rd display.
Comment #3
sorensong commentedThanks a bunch for your continued effort in this unexpected dilemma. I'm not sure what the forum guidelines are, but would it be possible to email you? I have a proposal.
Comment #4
nevets commentedWhat is different about the queries, I can imagine ways to do that with one query but it depends on how the queries are different.
Comment #5
sorensong commentedSo basically, what I'm trying to do is
-Display all 'content type A'
-If user of node is 'regular' then show basic basic fields (name, phone number).
-If user of node is 'pro' then show phone number plus extra fields (picture, description, extra links, etc...)
If this thing would be too involved to accomplish using backend techniques, I've flirted with the idea of some sort of a js/css hack using display:none. Unfortunately I'm not well versed in js. :/
Comment #6
sorensong commentedACTUALLY... if there was a module that simply turned 'Hide if empty' in to 'Hide if', that'd work perfectly! Could simply insert some SQL conditions. Might work, no?
Comment #7
sorensong commentedAny ideas, anyone?
Comment #8
merlinofchaos commentedYou could do some preprocessing on the rows to check the data on the user and, if it isn't a pro, set all the other fields to NULL. You'd do that hook_views_pre_view() and you'd have to be careful about 'group multiple' things. You'd need to unset data on the handler for that.
Comment #10
mstrelan commentedhook_views_pre_render() as mentioned in #1 worked great for me, but be warned that it may have issues with pagers.
My code below for reference if anyone wants it.
Comment #11
skrtvm commentedwhy cant you go for Views Merged Rows - D7?
https://www.drupal.org/project/views_merge_rows