So i tried to implement your suggested code to site and this is how it looks:
export async function FindDupls (){
let having = wixData . filter (). gt ( “count” , 1 );
let results,results2 ;
results = await wixData . aggregate ( “PunkteKonto” )
. group ( “copyOwner”,“location)” )
. count ()
. ascending ( “location” )
. having ( having )
. run ();
if ( results ) {
console . log ( “results:” , results );
let locationArray = results.items . map ( a => a.location );
console . log ( “location” , locationArray );
results2 = await wixData . query ( “PunkteKonto” )
. hasSome ( “location” , locationArray )
. ascending ( “location” )
. find ();
if ( results2 ){
console . log ( “results2” , results2 );
}
}
}
I added the code below the above mentioned code and it seems not to work.
The idea is to identify the currentUser first and display the locations he was at. If the same owner was more then once in the same location, it just shows the newest. (details in my last post)
Do I have to implement your suggest code into my code above or is something else incorrect?
As you can see I tried to group two fields (copyOwner&Location) to the code.
Thanks