I need help in connect four Collection

I need help in connecting 4 collections together via the main field that brings them together in value. The form in the image consists of six dropdown menus that use Queen Code . I want when I click on the category in the third dropdown, the data in the other collection will be read via code

this code for the dropdown from collection 1 , I need the code for the other dropdown

$w.onReady(function() {
    typeproduct();

    $w("#btnPay").onClick(()=>{
        $w("#txtMessage").show(); $w("#txtMessage").expand();
        $w('#txtMessage').text = "Waiting for response from Stripe...";
        $w('#txtMessageLabel').hide(); $w("#txtMessageLabel").expand();
        payNow(); //<<<---------------------------------------------------------------------------------What's that? Does this work ??? Now it is an own FUNCTION ! See code below!
    })
 
    $w("#DDinput1").onChange(()=>{DDinput2(), $w("#DDinput2").enable();});
    $w("#DDinput2").onChange(()=>{DDinput3(); $w("#DDinput3").enable();});
    $w("#DDinput3").onChange(()=>{       //<<<-------------------------------------------------------------------------------------> "productcategory"
        wixData.query("Designproduct")
        .eq("category", $w('#DDinput3').value)
        .find()
        .then((results)=> {
 let yourItem = results.items;
            $w('#image9').src = yourItem[0].categoryImage.toString()
            $w('#text76').text = results.items[0].desCategory.toString()
            $w('#amount1').text = results.items[0].price.toString()
            $w('#Amount').value = $w('#amount1').text
        });
        DDinput4();
 if ($w("#DDinput3").value !== "" && $w("#DDinput3").value !== 0 && $w("#DDinput3").value !== undefined){
            $w("#DDinput4").enable(),fill_DDinput4();
        }
 else {$w("#DDinput4").disable();}  
    })
$w("#DDinput4").onChange(()=>{       //<<<-------------------------------------------------------------------------------------> "productsize"
 wixData.query("AllProductSize").eq("size", $w('#DDinput4').value).find()
 
        DDinput5();
        $w("#DDinput5").enable(),fill_DDinput5();
    })
 
$w("#DDinput5").onChange(()=>{       //<<<-------------------------------------------------------------------------------------> "productcolor"
        wixData.query("AllProductColor").eq("productColor", $w('#DDinput5').value).find()
        .then((results)=> {
 let yourItem = results.items;
            $w('#image8').src = yourItem[0].colorPicture.toString()
        })
        DDinput6();
        $w("#DDinput6").enable();
    })

function  start_Function() {
    wixData.query("All Product Details").include("CategoryS").find()
    .then( (results) => {
        if(results.items.length > 0) {
        let RESULT = results.items;
        let firstITEM = RESULT[0];
        console.log(RESULT)
        console.log(firstITEM)
        let output1 = [], output2 = []
 
        for (var i = 1; i < results.items.length; i++) {
            output1.push(categoryS[i].???????????????????)
            output2.push(categoryS[i].???????????????????)
        }
        console.log(output1, output2)
        $w('#TXToutput1').text=output1.toString()
        $w('#TXToutput2').text=output2.toString()
    } else {    }
  } )
}

You give not enought input!
All DB-pics are needed! All included DATABASES.

output1.push(categoryS[i].???????????????????)
output2.push(categoryS[i].???????????????????)

Use my example again :grin:
After pressing on the —> “Include”-Button —> take a look into CONSOLE.
There you will find all the RESULT-STRUCTURE

https://russian-dima.wixsite.com/meinewebsite/how2-include

@russian-dima size collection

color collection

@contact39131
Complete this code here…

function  start_Function() {
    wixData.query("All Product Details").include("CategoryS").find()
    .then( (results) => {
        if(results.items.length > 0) {
        let RESULT = results.items;
        let firstITEM = RESULT[0];
        console.log(RESULT)
        console.log(firstITEM)
        let output1 = [], output2 = []
 
        for (var i = 1; i < results.items.length; i++) {
            output1.push(categoryS[i].???????????????????)
            output2.push(categoryS[i].???????????????????)
        }
        console.log(output1, output2)
        $w('#TXToutput1').text=output1.toString()
        $w('#TXToutput2').text=output2.toString()
    } else {    }
  } )
}

You have to look at the following lines… (example for SIZE).

 wixData.query("Main-Data-Collection").include("REFERENCED-FIELD")

Look what is the ID of your MAIN-Data-Collection
Look what is the ID of your included reference-field.

wixData.query("Main-Data-Collection")
    .include("REFERENCED-FIELD1") ---->  for example color
    .include("REFERENCED-FIELD2") ---->  for example size

Also change the output-settings…

output1.push(RESULT[i].???????????????????)
output2.push(RESULT[i].???????????????????)
output1.push(RESULT[i].REFERENCE-FIELD1-ID.REFERENCED-FIELD in your second DB)
output1.push(RESULT[i].sizeA.size) 

Take also a look into your console. You will find all the needed results and structure to look at and understand.

Connection to the —> FIRST-POST…
https://www.wix.com/corvid/forum/community-discussion/help-in-my-lightbox