1

I have a view of type "block" showing 1 node and another display attached to that block showing 3 nodes, in both displays nodes are sorted randomly, the problem is that I can't find the way to add a "distinct" for both views, so sometimes both displays show the same node because of the random sorting

Is there any way to solve it?

EDIT: I've posted an image with the real view, has you can see in this case first and the third nodes are duplicated, sometimes it happends because i need them to show randomly

enter image description here

3
  • Do you WANT them to be shown in random order? If not, have you defined a Sort Criteria for both views? If you use a sort criteria, you can use an Offset of 1 for the block showing the 3 nodes to avoid repeating the first node, shown in the other view.
    – argiepiano
    Commented Nov 27, 2015 at 2:45
  • @argiepiano i already have offest 1 in my attachment, but i need them randomly, so sometimes i get duplicated nodes between block and its attachments
    – xstean
    Commented Dec 1, 2015 at 19:02
  • See my answer below.
    – argiepiano
    Commented Dec 2, 2015 at 2:31

2 Answers 2

1

Rather than using a block for the top node, and an attachment for the lower 3 (like you are using now), I would use just one block (or page) that shows only 4 nodes, chosen at random with Global: Random as a Sort criteria (you can specify only 4 items to be shown by changing the Use pager: option).

THEN I would override the the Style output template file for the block (in Theme: Information in the Advanced area) to style the output of the block, for example by defining two divs, one for the top node, and one that wraps the 3 nodes below. Then use CSS to tweak the presentation (for example, floating left the bottom 3 nodes)

There are many good tutorials on overriding views templates, for example here.

1
  • Yep i use them all the time, i just wanted to know if i could do this by dashboard, i used to do everything by template but now i'm trying to use as less as i can. Guess i'll have to use them haha thanks. However i'll be checking that thread in case that someone figure it out
    – xstean
    Commented Dec 2, 2015 at 15:29
2

You can achieve you requirement by following below steps.

  1. Under view Advance setting, click on Query settings.
  2. Now select Distinct checkbox.

enter image description here

2
  • I always use it but, has i said, i need to distinct nodes between a block and its attachments. I've posted an image to clarify my question
    – xstean
    Commented Dec 1, 2015 at 19:10
  • @Nikhil, using distinct control single view but problem domain is to keep distinct results of two different views. Commented Dec 2, 2015 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.