Search into several databases and show all results in one table

@jonatandor35 Amazing thanks !

I tried the the more condensed code but it returns some small errors :


$w('#search').onClick(() => { 
const queries = ["Toppu1997", "Amada3"].map(collection => wixData.query(collection)             
   .contains("title", $w("#searchinput").value)             
   .or(wixData.query(collection)                 
   .contains("featuring_pkmn", $w("#searchinput").value)));

   Promise.all(queries.map(q => q.find())

  .then(r => {
    $w("#resultsTable").rows = r[0].items.concat(r[1].items);
  })
},)
})

For the code above i have these errors (highlighted in orange) " Property then does not exist on type 'Promise[].
And also a small error at the bottom ‘,’ expected, parsing error : unexpected token ).
When I delete the “)” I get another error below “Argument expression expected”.

Two last questions :

  • If I wish to add more databases to search into, in the code, how to I proceed, do I just add to the list ? ex : const queries = [“Toppu1997”, “Amada3”, “Amada4”].map

  • In my table there’s one colomn that doesn’t show any results, it’s blank everytime. The field in the collection is a reference field from another database, is there anyway to show that information ?

        {
"id": "col3",
"dataPath": "setname",
"label": "Set Name",
"width": 100,
"visible": true,
"type": "string"
},

Thank you !!