Download (Excel/CSV) Table Rows Only

Hi Wix

I followed this tread https://www.wix.com/corvid/forum/corvid-tips-and-updates/how-to-download-the-contents-of-a-data-collection-in-a-csv-file i can download what is query in the collection and results in the table rows but when downloading it to excel(csv) it includes other sensitive datas.

Now, im asking if there is a way to download only what is seen in the table? i dont want to includes those other row datas such as the dynamic links and financial datas.

Please help

Thanks,
DA

You can use the results returned by the query to build your own data to upload. So in the code in Steve’s article, you can get the results from queryResult.items, and build a new array of data leaving out the fields that you don’t want. Something like this:

if (!dataToUpload && queryResult.length > 0) {
    let myData = getRidOfSecretData(result.items);
    dataToUpload = myData;
} else {
    let myData = getRidOfSecretData(result.items); 
    dataToUpload = dataToUpload.concat(myData);
}

function getRidOfSecretData(items) {
    // create a new array of items without the "secret" fields
}

Hi Yisrael,

Im using this code, please can you do some correction? the console i made shows that newArray is undefined and the dataToUpload still has the sensitive datas. As you may know, i am not so good in coding.

function loadPage(queryResult) {
console.log("loadingPage " + queryResult.currentPage.toString());
if (!dataToUpload && queryResult.length > 0) {
let myData = getRidOfSecretData(queryResult.items);
dataToUpload = myData;
console.log(dataToUpload);
} else {
let myData = getRidOfSecretData(queryResult.items);
dataToUpload = dataToUpload.concat(myData);
}
if (queryResult.hasNext()) {
queryResult.next()
.then((result) => {
loadPage(result);
})
} else {
console.log(“Create payload for download”);
let jsonPayload = JSON.stringify(dataToUpload);
sendMessageToComponent({ action: “data”, payload: jsonPayload });
}
}

function getRidOfSecretData(items) {
let newArray = [{ title: items.title, tourReferenceNo:items.tourReferenceNo, rfqStatus: items.rfqStatus }]
console.log(newArray);
}

Thanks,
DA