I am quite new in javascript and I did not find the answer to my problem yet.
Actually I use a for loop to get the content of several csv files, and add each content to a global csvstring in order to download the total csv file at the end. But the content of each csv is obtained with d3.csv which is asynchronous, so if I update my total csvstring in d3.csv, I cannot use it to save the total csv afterwards since the csvstring is not updated yet. How should I do that ?
My code, which is not working, is the following :
//here is code to define the queries
csvstring = "";
for (i=0 ; i<queries.length ; ++i) {
d3.csv(queries[i], function(data) {
//here is code to format data as a csvstring and then
csvstring += data_as_csvstring;
}
});
//here is code to download csvstring as a csvfile
I hope I made myself clear, and I thank you in advance for your answer !
Mag