Hello everyone, I summarize my problem, I do not know if it can be done.
I have 3 collections and a table
1 First Collection “RegoleCodeUtente” which has two reference columns
- First reference “DB_regCode_UserID” from the “Infoutenti” collection with primary key DB_memberUserId
- Second reference “DB_regCodeCode” of the “DataSetCode” collection with primary key DB_codeCode
2 Second Collection “DataSetCode” which has a reference column
- Reference column “DB_codeCodeDataNameEvento” of the “DataSetCerimonie” collection with primary key DB_cerimonieCodeDataNomeEvento
3 Third Collection “DataSetCerimonie” where there is the column DB_cerimonieNome
What I’m trying to do, is knowing this data “DB_regCode_UserID” reference of the first collection, I have to find all the corresponding values of “DB_cerimonieNome” of the third collection and insert them in a table
Is it possible to make another query from the results of a query?
If I try to add or copy the “DB_cerimonieNome” field in the “DataSetCode” collection as I do with .include, I will update the table with all the results, since I have always seen in the esmpi always find the corresponding value of item [0]
Is there a solution?
I hope I explained myself, I put an example of what I want to do but I think the road is wrong
wixData.query('RegoleCodeUtente')
.eq('DB_regCode_UserID', member)
.include("DB_regCodeCode")
.find()
.then(results => {
let items = results.items;
let item = items[0]; //with this I find only the first result. But I have more results?
let Evento = items.DB_regCodeCode.DB_codeCode;//
wixData.query('DataSetCerimonie')
.eq('DB_codeCode', Evento)
.include("DB_codeCodeDataNameEvento")
.find()
.then(results => { // not work
let items = results.items;
let item = items[0]; //with this I find only the first result. But I have more results?
let EventoTable = items.DB_codeCodeDataNameEvento.DB_cerimonieNome;
$w('#teamsTable').rows = EventoTable;
});
}
});
I wrote a horrible code, but I hope to explain better what I need
Thank you all