Well you do not provide a lot of your setup.
Anyone knows the structure of your database.
.
.
.
Your database could look like….
| col1 |
col2 |
col3 |
col4 |
col5 |
col6 |
col7 |
| title |
raekke |
ekPaHo |
ar |
navne |
klub |
billede |
| DM U15 piger |
U15 |
Piger |
2024 |
Emma Jensen |
Hillerød BK |
image://emma.jpg |
| DM U15 piger |
U15 |
Piger |
2024 |
Sofie Hansen |
Roskilde BK |
image://sofie.jpg |
| DM U15 piger |
U15 |
Piger |
2023 |
Laura Nielsen |
Odense BK |
image://laura.jpg |
| DM U15 drenge |
U15 |
Drenge |
2024 |
Mikkel Sørensen |
Aalborg BK |
image://mikkel.jpg |
| DM U15 drenge |
U15 |
Drenge |
2024 |
Lucas Pedersen |
Herning BK |
image://lucas.jpg |
| DM U15 drenge |
U15 |
Drenge |
2023 |
Jonas Madsen |
Horsens BK |
image://jonas.jpg |
| DM U17 piger |
U17 |
Piger |
2024 |
Clara Olsen |
Aarhus BK |
image://clara.jpg |
| DM U17 piger |
U17 |
Piger |
2023 |
Amalie Lund |
Viborg BK |
image://amalie.jpg |
| DM U17 drenge |
U17 |
Drenge |
2024 |
Frederik Holm |
Esbjerg BK |
image://frederik.jpg |
| DM U17 drenge |
U17 |
Drenge |
2024 |
Kasper Vang |
Hjørring BK |
image://kasper.jpg |
| DM U19 piger |
U19 |
Piger |
2024 |
Nanna Berg |
Aarhus BK |
image://nanna.jpg |
| DM U19 drenge |
U19 |
Drenge |
2024 |
Oliver Winther |
Randers BK |
image://oliver.jpg |
| DM U19 drenge |
U19 |
Drenge |
2023 |
Rasmus Krogh |
Vejle BK |
image://rasmus.jpg |
| DM Senior mix |
Senior |
Mix |
2024 |
Sara Madsen |
Køge BK |
image://sara.jpg |
| DM Senior mix |
Senior |
Mix |
2024 |
Oliver Nielsen |
Esbjerg BK |
image://oliver.jpg |
| DM Senior mix |
Senior |
Mix |
2023 |
Lise Andersen |
Hørsholm BK |
image://lise.jpg |
| DM Senior damer |
Senior |
Damer |
2024 |
Mia Bruun |
København BK |
image://mia.jpg |
| DM Senior herrer |
Senior |
Herrer |
2024 |
Thomas Krog |
Silkeborg BK |
image://thomas.jpg |
| DM Senior herrer |
Senior |
Herrer |
2023 |
Jens Mortensen |
Odense BK |
image://jens.jpg |
Thanks, now I got it to show the 19 groups where it says “DM”, but there should only be 12 different groups, which is also determined by Row= “row” and Type=“ekPaHo”.
And all of those who will read your post (AND IS NOT A DANISH) won’t really understand your issue.
So lesson No-1: —> ALWAYS CODE IN ENGLISH !!! → CODING LANGUAGE is → ENGLISH!!!
You of course can code in your own language, but you will get problems doing this.
One of those problems is already available, since anyone do answer to your post, because not everyone will understand your issue (due to no Danish language experience)
The first confusion will arize when you are talking on some kind of → ROWS <–.
In real you are talking about → raekke
Translated into english (the language everybody understands) → taht means ROWS, and even this is still not the real word you were looking for!!!
Since you are working on a → SOCCER ← or → FOOTBAL ← table / database → the real word you were searching for is → DIVISION
So all of the following confusions is gone right now, right? …
What You Should Decide
You have two options, depending on what “Row” actually means in your database:
Option A – “Row” means raekke
If “Row” = raekke, then your database already has the correct field (raekke), and you don’t need an extra one.
You just need to rename it in your visual table header so it’s clear:
| title |
row (raekke) |
type (ekPaHo) |
… |
| DM U15 piger |
U15 |
Piger |
… |
| DM Senior mix |
Senior |
Mix |
… |
Option B – “Row” is a separate field
If your data actually includes a distinct row value (for example, a numeric round ID, or a league position),
then you need to add that field to your database and to your script.
**
You can follow me ?
So before someone can help you with your issue, that someone will get first totally different issues, with translations and understanding your needs and questions.
So how did your database look like one more time???
Like that…
| Column 2 |
Column 3 |
Column 4 |
D |
E |
F |
G |
| title |
division |
type |
year |
name |
club |
image |
| DM U19 girls |
U19 |
Girls |
2024 |
Nanna Berg |
Aarhus BK |
image://nanna.jpg |
| DM U19 boys |
U19 |
Boys |
2024 |
Oliver Winther |
Randers BK |
image://oliver.jpg |
| DM U19 boys |
U19 |
Boys |
2023 |
Rasmus Krogh |
Vejle BK |
image://rasmus.jpg |
| DM U17 girls |
U17 |
Girls |
2024 |
Clara Olsen |
Aarhus BK |
image://clara.jpg |
| DM U17 girls |
U17 |
Girls |
2023 |
Amalie Lund |
Viborg BK |
image://amalie.jpg |
| DM U17 boys |
U17 |
Boys |
2024 |
Frederik Holm |
Esbjerg BK |
image://frederik.jpg |
| DM U17 boys |
U17 |
Boys |
2024 |
Kasper Vang |
Hjørring BK |
image://kasper.jpg |
| DM U15 girls |
U15 |
Girls |
2024 |
Emma Jensen |
Hillerød BK |
image://emma.jpg |
| DM U15 girls |
U15 |
Girls |
2024 |
Sofie Hansen |
Roskilde BK |
image://sofie.jpg |
| DM U15 girls |
U15 |
Girls |
2023 |
Laura Nielsen |
Odense BK |
image://laura.jpg |
| DM U15 boys |
U15 |
Boys |
2024 |
Mikkel Sørensen |
Aalborg BK |
image://mikkel.jpg |
| DM U15 boys |
U15 |
Boys |
2024 |
Lucas Pedersen |
Herning BK |
image://lucas.jpg |
| DM U15 boys |
U15 |
Boys |
2023 |
Jonas Madsen |
Horsens BK |
image://jonas.jpg |
| DM Senior women |
Senior |
Women |
2024 |
Mia Bruun |
København BK |
image://mia.jpg |
| DM Senior mix |
Senior |
Mix |
2024 |
Sara Madsen |
Køge BK |
image://sara.jpg |
| DM Senior mix |
Senior |
Mix |
2024 |
Oliver Nielsen |
Esbjerg BK |
image://oliver.jpg |
| DM Senior mix |
Senior |
Mix |
2023 |
Lise Andersen |
Hørsholm BK |
image://lise.jpg |
| DM Senior men |
Senior |
Men |
2024 |
Thomas Krog |
Silkeborg BK |
image://thomas.jpg |
| DM Senior men |
Senior |
Men |
2023 |
Jens Mortensen |
Odense BK |
image://jens.jpg |
|
|
|
|
|
|
|
…or something like that …???
| Column 1 |
Column 2 |
Column 3 |
Column 4 |
E |
F |
G |
H |
| # |
title |
division |
type |
year |
name |
club |
image |
| 7 |
Funen Championship U19 Girls |
U19 |
Girls |
2024 |
Nanna Berg |
Aarhus BK |
image://nanna.jpg |
| 8 |
Funen Championship U19 Boys |
U19 |
Boys |
2024 |
Oliver Winther |
Randers BK |
image://oliver.jpg |
| 5 |
Funen Championship U17 Girls |
U17 |
Girls |
2024 |
Clara Olsen |
Aarhus BK |
image://clara.jpg |
| 6 |
Funen Championship U17 Boys |
U17 |
Boys |
2024 |
Frederik Holm |
Esbjerg BK |
image://frederik.jpg |
| 1 |
Funen Championship U15 Girls |
U15 |
Girls |
2024 |
Emma Jensen |
Hillerød BK |
image://emma.jpg |
| 2 |
Funen Championship U15 Girls |
U15 |
Girls |
2024 |
Sofie Hansen |
Roskilde BK |
image://sofie.jpg |
| 3 |
Funen Championship U15 Boys |
U15 |
Boys |
2024 |
Mikkel Sørensen |
Aalborg BK |
image://mikkel.jpg |
| 4 |
Funen Championship U15 Boys |
U15 |
Boys |
2024 |
Lucas Pedersen |
Herning BK |
image://lucas.jpg |
| 11 |
Funen Championship Senior Women |
Senior |
Women |
2024 |
Mia Bruun |
København BK |
image://mia.jpg |
| 10 |
Funen Championship Senior Mix |
Senior |
Mix |
2024 |
Oliver Nielsen |
Esbjerg BK |
image://oliver2.jpg |
| 9 |
Funen Championship Senior Mix |
Senior |
Mix |
2024 |
Sara Madsen |
Køge BK |
image://sara.jpg |
| 12 |
Funen Championship Senior Men |
Senior |
Men |
2024 |
Thomas Krog |
Silkeborg BK |
image://thomas.jpg |
However at least it is now more clear and we have a first visual databse structure similar to one you have in your setup.
So now we can continue with…
…what about…???
What hasSome() / hasAll() do
-
These only work on array fields in your database.
-
Example: if a field categories is an array like ["U15","Girls"]:
wixData.query("Players")
.hasSome("categories", ["U15","U17"])
.find()
.then(res => console.log(res.items));
Important: your division and type fields are strings, not arrays. So .hasSome() / .hasAll() cannot be used directly unless you store them as arrays.
…or what about…???
Using .contains() or .eq() instead
Since your database fields are strings, you can filter like this:
wixData.query("Players")
.contains("title", "Funen") // finds records with "Funen" in title
.eq("division", "U15") // optional: exact match
.eq("type", "Girls") // optional: exact match
.find()
.then(res => console.log(res.items));
.contains() → partial match (like “DM” or “Funen”)
.eq() → exact match
This is exactly what most Wix repeater filtering examples use.
…and what about…???
Why .hasSome() doesn’t work here
- Your goal is to group by division + type and display unique groups.
- Fields
division and type are strings, so each player is just one value, not an array.
.hasSome() is for filtering array fields, not grouping or unique combinations.
YOU SURELY DID CHOOSE THE RIGHT DATABASE-STRUCTURE???
Let’s make some conclusions.
Conclusion
- Use
.contains() or .eq() for filtering string fields.
- Use JS grouping logic (like
comboMap) to create unique groups from string fields.
- Only use
.hasSome() / .hasAll() if the field in your database is an array.
And if you would not just use a pure AI solution, maybe you also would find something like —>
Equivalent Wix Aggregate Example
import wixData from 'wix-data';
wixData.aggregate("Players")
.group("division") // first group by division
.group("type") // then group by type
.count() // count number of players in each group
.run()
.then(results => {
// results.items contains the grouped data
results.items.forEach(group => {
console.log(`Division: ${group.division}, Type: ${group.type}, Count: ${group.count}`);
});
})
.catch(error => {
console.error("Aggregation Error:", error);
});
Now, since you have a lot more informations, maybe you will now find the right way of what and how to do, to be able to solve your issue.
What you are doing right now is the beginning of the creation of an own → FILTERING-ENGINE <—
WHAT???
Filtering-Engine???
--------------------------------> Search results for 'filtering-engine' - Community Support Forum | Wix Studio
Some additional informations
:**
Now you could generate some specific (return) functions like…
function get_FunenWinners() {...}
function get_UniqueGroups() {...}
function get_…
…but wait!!! Why not directly generating something like a —> reusable generic aggregation utility for your backennd ???
By the way, you knew that on backend it should work even faster?
EXAMPLE:
import wixData from 'wix-data';
/**
* Get grouped players by division and type
* @param {string} titleFilter - Optional: filter players whose title contains this string
* @returns {Promise<Array>} - Resolves to an array of groups with players
*/
export function getGroupedPlayers(titleFilter = "") {
let aggregate = wixData.aggregate("Players");
// Apply filter if provided
if (titleFilter) {
aggregate = aggregate.match(wixData.filter().contains("title", titleFilter));
}
// Build aggregation
return aggregate
.group("division")
.group("type")
.items(["_id", "name", "title", "division", "type"]) // include relevant fields
.run()
.then(results => {
// Map results to match desired output
return results.items.map(group => ({
division: group.division,
type: group.type,
players: group.items
}));
});
}
Usage Example
getGroupedPlayers("Funen")
.then(groups => {
console.log("Grouped Players:", groups);
})
.catch(error => {
console.error("Error fetching grouped players:", error);
});
Benefits of this approach
Reusable: call getGroupedPlayers() anywhere.
Optional filter: pass a title filter if needed.
Returns exactly the same structure as your manual groupsMap.
Fully server-side aggregation → faster and more efficient.
As you can see, there are so many possibilities and you can expand your code even much much more —> making it more [ROBUST, FLEXIBLE, DYNAMIC and AUTOMATIC and even if you want → AI-DRIVEN]
But all of those mentioned possibilities can be only achieved when using pure coded Wix-Data-Solutions! As soon as you start to mix it up with Datasets → you will get troubles.