Downloading customized 16 tables with one button

hi people,

i have container, and there are 16 tabs as tabbedContainer in previous container. for every table i have a query. with that query i created custom xmls files to download in event handler. at the beginnig i could download all files, but now it downloads only 10 files, rarely 12.
for load, i used {{user_log.isFetching}}, which is the longest lasted query to bring the data.
and i also divided my custom script into many pieces and added them as an event handler at download button. but at the end i got only again 10 files, when i clicked download button.

Hello @Halil_Ozturk ,

Thank you for your question.

It seems your issue could be related to several potential causes including limitations on the server side, browser, or in your code. Follow these troubleshooting steps to help identify the problem:

  1. Check for any server-side limitations that only allow a certain number of files to be downloaded at once.
  2. There might be a timeout issue where the queries responsible for downloading the files are taking too long to complete. Ensure all your queries are functioning correctly by checking each individually.
  3. Look for any error messages in the console when more than 10 files are being downloaded.
  4. Try downloading one of the failing files individually to see if there's a specific issue with that file, and check if there's any correlation between the files that succeed and fail.
  5. Your issue could be due to a limit on the number of simultaneous downloads your browser supports. Some browsers cap this at 10 or fewer. If so, consider breaking your download operation into smaller batches.
  6. Check to see if the problem occurs across different browsers or devices.
  7. If you are using asynchronous operations, such as Promises in JavaScript, make sure they are properly implemented. Your downloads may be overlooked because your asynchronous code is executing out of order.
  8. Consider implementing a delay or use promises to ensure files are fully downloaded before moving to the next file, e.g., by using .then(). Here's an example of how you can do this in JavaScript:
async function downloadFiles() {
  for (let i = 0; i < tabs.length; i++){
    await new Promise((resolve, reject) => {
      // trigger your download file query or function here
      {{query.download.trigger(
        additionalScope,
        {
          // trigger the next download only when the current one is successful
          onSuccess: function(data) {
            resolve();
          },
          onFailure: function(error) {
            reject(error);
          }
        }
      )}}
    }).catch((error) => {
      console.error('Error:', error);
    });
  }
}

downloadFiles();

Remember to replace query.download with your download file query, and tabs.length with the number of downloads you need to perform.

  1. If your browser supports more than 10 downloads concurrently, there could be an issue with the platform - in this case, Retool. If you suspect this, contact their support for assistance.

Remember that downloading large amounts of data at once can lead to high memory usage and slow performance. If after working through these steps you're still experiencing issues, it would be best to contact the support team of the platform you're using.

Hope these suggestions help you get to the bottom of the issue.

-Brett

1 Like

many thanks brettp,

i solved it like number 8. i wrote a script for a button to download 8 files, which triggers another script (for other 8 files). But i need to implement 2000ms wait in debounce in 1st script, otherwise it does not work.
8 tables are downloaded after clicking download button, than 2000ms later first script kicks start other 2nd script, which starts to download another 8 tables.
those tables' size are not big. actually at the beginning it worked, i could dowload 16 table at once. but after release it often does not work. we needed to be sure, it is working.