@motiontc
You can use an alternative coding-way to code it…
import wixData from 'wix-data';
$w.onReady(function() {$w('#button1').onClick(()=>{xxx();});});
function xxx(){
let toInsert = [], data = {};
let inputAmount = 5;
for (let index = 1; index < inputAmount-2; index++) {
data.fullName = $w('#input1').value;
data.emailAddress = $w('#input2').value
//--------------------------------------
data.sessionName = $w('#input'+(index+2)).value
toInsert.push(data);
}
if ($w('#dropdown4').value) {
data.fullName = $w('#input1').value;
data.emailAddress = $w('#input2').value
data.sessionName = $w('#dropdown4').value
}
wixData.bulkInsert("CVENTRegistration", toInsert)
.then((res)=> {let item = res; console.log(res);})
.catch((err)=>{let errorMsg = err;});
}
This is just an quick generated example, which might not work correctly, but it should show you how to generate your wished functionality.