Hide/Show Elements based on data in dataset

Hello

i have a dataset and dynamic pages and i want to show or hide a button to play a video if there is data. So if data exists in the dataset for the page for a video url then i want a button to show.
i also want to link the button to another hidden element or even show a lightbox with a video player in in it.
Is this even possible? I have my data set, my dynamic page, my lightbox with the video but i cant seem to find a way to play this specific video on this page only

You can set in the collection Data on the page (little icon) When you go into settings you can set a filter. Like when this is or isn’t etc. I hope that helps

No it doesn’t. I have filters already. If there is a field in my dataset which is blank and that is linked to to an item in my dynamic page then the item will be invisible. Is what I need help with.

can you send me a screenshot ?

I don’t understand how a screenshot will help. Do you understand what my problem is? I want to trigger a lightbox using a button which is only visible if the data in the context of the page matches the condition set in the button code.

Hello @russelljhunte ,

I’m Shiri from the Editor X team, Thanks for reaching out.
Conditional hide & show could be achieved with a few lines of Velo code.

The Velo forum has some good sources for help in these cases.
Here is a relevant post that shows something similar:

I made you a short tutorial.
Hope this helps you:

Hi @shirim @shirimahler that is a great post but it doesnt help me how to hide items if there is no data present in my database. if i have a text field and there is no data, the space is empty or blank. If i have a button connected to my dataset and the dataset has no data the button is visible but doesn’t work. I can do this. but it means that on 5 pages there will be a button not working and on two it will work.

Take a closer look at the video.
You need to set the button and video to be hide on load and only if you have data for the video we showing the button and the video.
Which means that if you have a dynamic page without data for the video the button and video is hidden.

Thanks matanya. the code worked.
no video
Everyday D (Distance) (threedesignviz.com)
with video
Ultimate Mobile (threedesignviz.com)

Beautiful!

Hi, @Matanya I have tried the code on repeater @ homepage. But it seems not working. I want to hide the icon that doesn’t have the social media link.

Hey @salmizulaikha ,

Since this is an old thread, may be best to tag Matanya as he might not get the ping otherwise.

Might suggest also our Velo forum with the coding and perhaps a video of what you have currently as there is more specific help with Velo.

hi yall

I have similar question/challenge and I’m not good at coding so bear with me. I have made a dataset for a dynamic page: https://www.danishjazz.com/artists

Under each artists, there are four buttons: Instagram, facebook, listen and website. Some artists donøt have an instagram so how do I hade that button on the respective artist profile site? Example: https://www.danishjazz.com/artist/5-go-adventuring-again

Did you ever figure this out?