I have blocker with bulk insert more then 5500 rows of data in CSV, my javascript code and SQL query, can only bulk insert a maximum of 5500 rows of data in CSV, if row of data in CSV more then 5500 rows of data, there is no error when uploading csv and bulk insert data to SQL, but in the background it doesn’t continue or run to the next code, code execution stops when Execution starts from widget request
, like photo I attached in this topic. How can I bulk insert more than 5500 rows of data using JavaScript code and SQL queries in AppSmith?
This is my JavaScript code:
export default {
varificationUpload3PlReconFunc: async () => {
let queryUser = `password = MD5('${InputVerification3PLRecon.text}')`
get_user_verification.run((data) => {
if (data.length > 0 && data[0].is_active === true) {
let email = data[0].email
showAlert('Successfully Verification');
showModal('ModalUploadData')
let fileName = FilePicker3PLRecon.files[0].name
let splitedFileName = fileName.split(".")
let splitedByUnderScore = splitedFileName[0].split("_")
let sbuName = splitedByUnderScore[splitedByUnderScore.length - 1]
var current = new Date()
//! Mapping CSV file make to array of objects
let fileData = FilePicker3PLRecon.files[0].data.map(item => item)
let jsonParse = JSON.parse(JSON.stringify(fileData));
//! Remove or filter awb data if data equals to empty string or undefined
let dataFilter = jsonParse.filter(e => e.awb);
//! Convert array of object to format string
//! example of result : ('example1','example1','example1','example1')
let params = `(${dataFilter.map(item => `\'${String(item.awb)}\',\'${item.courier}\',\'${item.actual_service}\',\'${item.actual_origin}\',\'${item.actual_destination}\',\'${item.actual_weight == "" ? 0 : item.actual_weight}\',\'${typeof item.actual_amount === "number" ? item.actual_amount : parseInt(item.actual_amount.replace(/\,/g,''),10)}\',\'${typeof item.settled_amount === "number" ? item.settled_amount : parseInt(item.settled_amount.replace(/\,/g,''),10)}\',\'${item.remark}\',\'${item.notes}\',\'${current.toLocaleString()}\',\'${email}\',\'${splitedFileName[0]}\',\'${sbuName}\'`).join("), (")})`;
//! Bulk insert to SQL Database
bulk_insert_3pl_recon.run(() => {
closeModal('Verification_Upload_3PL_Recon')
closeModal('ModalUploadData')
showAlert('Successfully added new entries 3PL Recon');
select_3pl_recon.run()
resetWidget("FilePicker3PLRecon")
}, () => {}, {
'data': params
});
} else {
showAlert("Password are Invalid");
closeModal('ModalUploadData')
closeModal('Verification_Upload_3PL_Recon')
}
}, () => {}, {
'data': queryUser
});
}
}
This is my SQL Insert query:
insert
into
recon_3pls.recon_3pls_test (awb,
courier,
actual_service,
actual_origin,
actual_destination,
actual_weight,
actual_amount,
settled_amount,
remark,
notes,
created_on,
created_by,
import_file_name,
sbu)
values {{this.params.data}};
Thank You All.