Issue sorting with blank fields

I have a repeater that is connected to a database for placings. People can enter there top 25 picks into the repeater. Everything is working, saving, etc, except the sort. What I want is for the item with a value of 1 to show up first, 2 second, etc. until they get to the cells with no values entered, then those would be alphabetically. (1: Susie, 2: Billy,… “”:Adam,“”:Brad, etc)
Here is the code I am using:

export function button2_click(event) {
//sort();
$w("#dataset1").setSort(wixData.sort()
.ascending("ythEq")
.ascending("title")
)
console.log("it should be sorted")
}

“ythEq” is a numeric field
“title” is a text field

How do I get the repeater to sort 1-20 or 25 then sort the remainder of items in the database that don’t have anything in “ythEq” to sort alphabetically?

Hi,
I see that you are trying to filter the dataset. For the described functionality, it’d be better to query the database and sorting the data and then pass it into the repeater.

wixData.query("4filter") //4filter - name of your database
.ascending("number", "title")
.find()
.then((results) => {
if (results.items.length > 0) {
let firstItem = results.items;
console.log(results.items) //sorted onject
} else {
// handle case where no matching items found
}
})
.catch((err) => {
let errorMsg = err;
});

Then, to pass data into the repeater you can use forEachItem() method. Click here to learn more.