Hi ladies and gents my first post so I hope you are well, and that you dont find this post annoying as i'm sure it will have been asked before but I have now been up all night and its sending me mental as a new Drupal person as of yesterday..

I've looked at so much in the last 24 hours that I'm going boogley eyed but by the end of today if I'm not snapped up for an assistant's post on weight watchers . com or similar with my new knowledge then something is seriously wrong..

However, I digress.. Back to basics... :))

So I have a new D8 install.. I have created a content type called "Recipes" (isn't that where all the n00bs start? too obvious right? bare with me...) and within that content type is a text(plain) field called "ingredients" which is unlimited to allow me to add individual ingredients.

I have managed to achieve by some miracle to use "Views" to create a "Block" and display the data with the following-

FIELDS - Content: Ingredients
FILTER CRITERIA - Content: Publishing status (= Yes) - Content: Content type (= Recipes)

and this pulls data but all i want is to display the data (ingredients) just from one random node - all i seem to be able to achieve is all the data.. but from all nodes.. and that's where im stuck..

my idea is to get a "Guess the recipe" block with just the ingredients from one random node displayed in a block, and if the user can't stand the heat (did you see what I did there? recipes? cooking? nevermind.. ;) then they press the ingredients and go through to the recipe.. (that bit I have working and am quite proud of myself..)

I have pressed every button I can now think of in contextual filters to see if the answer is in there but to no avail...

Is the answer staring me in the face or is this where I need to delve into a bit of custom coding?

Any help appreciated.. Mr Chips :D

Comments

ykarthikvarma’s picture

Greetings mrandmrschips,

Looking at your elaborated issue :) I think you just want to have a view block to display random node (one node at a time) data of a specific content type right !

-> Set the pager to display 1 node
-> add a sort criteria called "Random"

And thats it you have a view block displaying random data.

Note: You may want to add the fields only which you want to display !

mrandmrschips’s picture

I knew I was just missing the blindingly obvious...

But 3 clicks and done.. well..

ty so much Ykarthikvarma.. A star indeed..

I would like to think you may have helped me avoid another sleepless night.. But theres so much can be done though now I know where the random part is for so many other ideas.. I may well be grabbing the matchsticks for the eyelids.. I feel this Drupal journey could be long one..

peace...