0

Probably a stupid question, but I'm stumped... I have a simple View which lists all terms from a Taxonomy. Within this is a Global Field Type of "View" which is trying to list any content related to the Term, and authored by the UID present in the URL. However I am unable to pass the parameter from the URL to the View using standard Replacement Patterns. I can pass the Term using [!name] but not a parameter from the URL.

So parent view URL is /report

This is called with the UID appeded, e.g.: /report/34

How do I get 34 passed to the embedded view as contextual filter?

Many thanks for any help on this seemingly simple use case!

****** ANSWERED ********

Check Alfred's answer below, but also make sure the order of your Contextual Filters is correct. In this case, I was passing a blank value, rather than NULL value, as the first parameter from the parent view.

Swapping the order of the Contextual Filters over mean't I could pass a NULL value from the parent view (i.e. just the first one). Hope this makes sense.

2

In an embedded view you typically use the "When the filter value is not available" option for the contextual filter to achieve this.

Select "provide default value" then choose "raw value from URL" and set the path component to be 1.

You should also set validation criteria and select what should happen when the value is missing or incorrect.

  • That's exactly what I've tried, Alfred. But the embedded view is returning no items. Does it matter what type of display I use? Tried with Master, Page, Pane, and Block. – Darren Sep 19 at 11:49
  • Maybe there's something else such as the set up of the contextual filter. Perhaps you are filtering the wrong thing. – Alfred Armstrong Sep 19 at 12:01
  • 1
    OK, so I had two Contextual Filters in the embedded view and the first one was the UID, which was looking for the raw value [2] from the URL if not provided. The second contextual filter was getting the value from the parent view as the second parameter... – Darren Sep 19 at 12:03
  • 1
    I had to change the order of the contextual filters in the embedded view, so the UID filter became the second in the list. Then I could provide the first contextual filter in the parent view as the first and only parameter. Before this, the parent view was passing the UID filter first, which was blank, which makes sense. It wasn't even getting as far as looking in the URL. Blank isn't null, now, is it? Silly user. – Darren Sep 19 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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