This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Upload file and read into collection

Hi Experts,

I have a file upload node using which I upload a file to a server. I think trigger an event and read that data into a table. So far so good. 

I now need to load this data into a collection. To do this, I though of using a while loop with the condition

0 = select count() from BulkUploadUsers

Inside the loop, I load the collection.

I thought the collection will be loaded in one go, however the while loop quits after it loads the first object.

 

Is there some way to effectively give feedback from the backend to the front end that it can now load the collection?

 

Thanks

Kin

Parents
  • Just tried this and it works! Here's a summary of how I did it:

    1) Create 2 tables (t1 and t2), one to store the data in the uploaded CSV file, another to store the status of the last import of that file
    2) After uploading the file, trigger the event to import the data into t1. After the import, insert an entry into t2 and update a status column.
    3) In the while loop, loop until count = 0 for the t2 collection. Inside the loop, load the t2 collection with a corresponding where clause
    4) After the while loop, you can now load t1 and everything should work

    I also added a column in both tables for CCC_FileName which allows this to be run concurrently as long as the generated file name of the upload is unique (Easily done)
Reply
  • Just tried this and it works! Here's a summary of how I did it:

    1) Create 2 tables (t1 and t2), one to store the data in the uploaded CSV file, another to store the status of the last import of that file
    2) After uploading the file, trigger the event to import the data into t1. After the import, insert an entry into t2 and update a status column.
    3) In the while loop, loop until count = 0 for the t2 collection. Inside the loop, load the t2 collection with a corresponding where clause
    4) After the while loop, you can now load t1 and everything should work

    I also added a column in both tables for CCC_FileName which allows this to be run concurrently as long as the generated file name of the upload is unique (Easily done)
Children
No Data