Filter a dataset based on another dataset

Hello,
I have 2 datasets, one for Movies and one for Dates. I would like to filter the Movies dataset in a repeater to only show Movies that have Dates listed in the Dates dataset. I have set up the primary key in the Movies dataset to be the MovieID. I then set up a reference field (MovieID) in the Dates dataset to reference the Movies dataset.

When a date and time are added to the Dates dataset for a particular movie, the MovieID is added as well. If no dates and times exist in the Dates dataset for a specific movie, that movie will not appear in the repeater. If multiple dates exist for a single movie, the movie information should only appear once in the repeater.

Please help me get on the right track.

Thanks

https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-reference-fields-4034931

Thank you. This is helpful, but I believe I need to accomplish this through code.

If you are wanting code then here is an example of sorting a repeater with multiple filters:

The Page

Repeater: #repeater1​​
​​User Input: #searchbar
​Dropdown: #dropdownfilter
​Image Element: #searchicon

The Database

Create a database: Products (dataset1)
​
Recommended fields:
Product Name Field: product
Product Description Field: description
Price Field: price
Product Type Field: producttype (for filtering)
​
Then link fields to your repeater.

Page Code

import wixData from 'wix-data';
​
// Set Dropdown Options //
​
$w.onReady(() => {
    wixData.query('Type')
        .find()
        .then(res => {
            let options = [{"value": "", "label": "All Types"}];
            options.push(...res.items.map(type => {
                return {"value": type.search,"label": type.search};
            }));
        $w("#dropdownfilter").options = options;
        })
});
let lastFilterSearch;
let lastFilterType;
let debounceTimer;
​
// Search Bar //
export function searchbar_keyPress(event, $w) {
​
    if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = undefined;
    }
    debounceTimer = setTimeout(() => {
        filter($w("#searchbar").value, lastFilterType);
    },200);
}
​ 
// Set Filters //
​
function filter(search, type) {
    if (lastFilterSearch !== search || lastFilterType !== type) {
​
        let newFilter = wixData.filter();
​
        if(search)
            newFilter = newFilter.contains('product',search);
​
        if(type)
            newFilter = newFilter.eq('producttype', type);
    $w("#dataset1").setFilter(newFilter);
​
    lastFilterSearch = search;
    lastFilterType = type;
​
    }   
}
​
// Dropdown Filter //
​
export function dropdownfilter_change(event, $w) {
    filter(lastFilterSearch, $w("#dropdownfilter").value);
}

For More Filters

import wixData from 'wix-data';

let lastFilter1;
let lastFilter2;
let lastFilter3;
​
// Set Filters //
​
function filter(filter1, filter2, filter3) {
    if (lastFilter1 !== filter1 || lastFilter2 !== filter2 || lastFilter3 !== filter3) {
​
        let newFilter = wixData.filter();
​
        if(filter1)
            newFilter = newFilter.contains('item1', filter1);
​
        if(filter2)
            newFilter = newFilter.eq('item2', filter2);
        if(filter3)
            newFilter = newFilter.ge('item3', filter3);
​
    $w("#dataset1").setFilter(newFilter);
​
    lastFilter1 = filter1;
    lastFilter2 = filter2;
    lastFilter3 = filter3;
​
    }   
}
​
// Dropdown Filters //
// NOTE: The order of the filter functions are important; lastFilter1, lastFilter2, lastFilter3 //
​
export function dropdown1_change(event, $w) {
    filter($w("#dropdown1").value, lastFilter2, lastFilter3);
}
​
export function dropdown2_change(event, $w) {
    filter(lastFilter1, $w("#dropdown2").value, lastFilter3);
}
​
export function dropdown3_change(event, $w) {
    filter(lastFilter1, lastFilter2, $w("#dropdown3").value);
}

You can use the following code to reset all filters. For pre-filtered inputs, change the “undefined” values to your pre-filtered values.

export function resetbutton_click(event, $w) { 
$w("#dropdownfilter").value = undefined; 
$w("#searchbar").value = undefined; 
$w("#dataset1").setFilter(wixData.filter()); 
}  

You can query the result from the first dataset then set the value to the second dataset filter.
Check how you can filter a dataset using code -here
Check how to get a value from data -here

Or other examples of how you can filter:
https://www.wix.com/corvid/example/cascading-form
https://www.wix.com/corvid/example/checkbox-dropdown
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-datasets
https://support.wix.com/en/article/about-displaying-content-from-multiple-database-collections-using-datasets

Two video examples too:
https://www.youtube.com/watch?v=r0DLqkRDJ34
https://www.youtube.com/watch?v=EhXed0u6wh0

Hi there, thanks for your reply, I am not wanting any input from the user, their email comes from their membership email (wix-users) and all of the videoIDs are all stored in the dataset, is there a way to do this without dropdowns or user input?

Did you get an answer to this?