Filling a dropdown from a query

I’m using a dropdown to select a member from a dynamicDataset and then filtering the same dynamicDataset for the dynamic page. When the dynamicDataset is filtered for the page, the dropdown item is reduced to the one that was selected. In clearing the filter the dropdown requires twice clearing and even then it doesn’t clear correctly. I was thing of filling the dropdown from a query or in worst case from a copied collection. Are there other alternatives.
Thanks in advance for any and all help. This is what I’ll presently trying.

import wixData from ‘wix-data’;
import wixLocation from “wix-location”;

//let DD1;

$w.onReady(function () {
//startup code
$w(“#dynamicDataset”).onReady( () => {
$w(“#dynamicDataset”).setFilter( wixData.filter() );
});
});

export function SelectMember_onclick() {
//Gather info from member selected and filter DS to that member only
$w(“#dynamicDataset”).onReady( () => {
$w(“#dynamicDataset”).setFilter( wixData.filter()
.contains(“title”, $w(“#SelectMember”).value)
);
$w(“#text4”).text = $w(“#SelectMember”).value ;
});
}

export function Submit_onclick() {
//info on the member is correct time to save and setup for the next member
$w(“#dynamicDataset”).onReady( () => {
$w(“#dynamicDataset”).save() ;
$w(“#dynamicDataset”).setFilter( wixData.filter() );
$w(“#dynamicDataset”).refresh() ;
});
}

export function ReturnBut_click() {
//Done with all members updates time to go back to the dashboard
$w(“#dynamicDataset”).onReady( () => {
$w(“#dynamicDataset”).setFilter( wixData.filter() );
// $w(“#MembersDS”).refresh() ;
// wixLocation.to(“/member-dashboard”);
});
}

Hey
the methods you use all return a promise, either use async and await or handle the promise before you start next one.

$w(" #dynamicDataset “).save().then((res)=>{
$w(” #dynamicDataset “).setFilter( wixData.filter() ).then((res2)=>{
$w(” #dynamicDataset ").refresh().then((res3) =>{
console.log(”done”);
});
});
});

Thanks I’ll give it a try