Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I have an app with a table with 17k rows.
I want to download it in a csv file but I would like my output to be no longer than 5k rows.
I would like to know:
is it possible to:
1) Either have multiple output file (so for 17k that would be 4 files)
2) or I can choose which rows to download (like "From 1 to 4999", "From 5000 to 9999", and so on...)
?
Thank you
I'm not aware of any way to do this natively on the front end. You could perhaps achieve this using nPrinting, though, by having multiple reports each limiting to certain rownumbers from the original table. You could also probably achieve this via script by looping through the table to load 5000 lines at a time and then store them to a file.
I don't really understand how to do it with a loop throught the table.
If I get it right, if I have 17k rows I should have 4 tables; but how can I show them in front end as a unique table?
Could you please give me an example of script?
Thank you
In this scenario, you would not show them as one table (or at all), since you're just loading them for the sake of saving them to a CSV file. You would continue to show whatever you were showing in the first place.
Pseudoscript for the loop:
Table1:
Load *, RowNo() as RowNumber
From YourTable;
Let vStart = 1;
Let vRows = NoOfRows(Table1);
Do
Table2:
Noconcatenate Load * Resident Table1
Where RowNumber Between vStart and vStart*5000;
Store Table2 into Somefile.csv; // Note - probably best to append the variable here to generate unique file names
Drop Table Table2;
Let vStart = vStart + 5000;
Loop Until vStart > vRows ;
Thank you, so, if I get this straight:
In this way I will have my data downloaded in the csv file as soon as the user opens the app, because the download is in the script; am I correct?
Not quite - the CSVs will be saved whenever the app is reloaded, independently of when the user accesses it.