I also have a 1.5 second delay in the code below to stop the searches happening too quickly. That part works fine.
I query the first dataset and return two results to text on the screen. That works.
What I am trying to do is to pass a result from the first query, fkArticleCode, into the second query such that it returns two more results that I again can pass to text on the screen. This is the part that will not work. The text on the screen for the second results does not update.
I have followed the suggestions here but cannot seem to get my code working.
I stripped back all my unnecessary code just to get a msall proof of concept working as shown below but it now states “the keyword let is reserved” for line:
let article = res.items[0];
Any suggestions?
import wixData from 'wix-data';
export function articleCodeInput_input(event) {
let query1 = wixData.query('ProcureASSISTv1').eq('articleCode', articleCode).eq('code', code);
let query2 = wixData.query('PAFKonly');
query1.find().then(res =>
let article = res.items[0];
$w('#articleCode').text = article.articleCode;
$w('#description').text = article.description;
cons items = res.items;
return query2.eq("fkArticleCode", items[0].field).find();
}).then(items=>
let second = items.items[0];
$w('#fkArticleCode').text = second.fkArticleCode;
$w('#fkDescription').text = second.fkDescription;
})