Page 1 of 1

Downloading per Province in CSWeb

Posted: June 28th, 2025, 4:20 am
by YFT_CBSD
Hi all,

Im using a batch application to download a csdb file using the syncdata.
For example,

syncdata(GET, test_data_dict, "01001");

then ill set the external data(test_data_dict)=01001.csdb.

How can i automate this process? and for example i want to download multple province(1file=1province) in a single run?
01001
01002
01003
01004


Thanks

Re: Downloading per Province in CSWeb

Posted: June 30th, 2025, 12:30 am
by YFT_CBSD
Additional question: What does it mean when I'm downloading and suddenly close the batch application? My indicator of a successful download is when the .lst file appears, but in my case, the batch file closed and the .lst file didn’t appear.

Re: Downloading per Province in CSWeb

Posted: June 30th, 2025, 9:11 am
by Gregory Martin
If you're downloading from CSWeb, you can do something like:
List string provinces = "01001", "01002", "01003", "01004";

syncconnect(CSWeb, "....");

do numeric ctr = 1 while ctr <= provinces.length()

    setfile(DICT_NAME, provinces(ctr) + ".csdb", append);
   
    syncdata(GET, DICT_NAME, provinces(ctr));
   
    close(DICT_NAME);

enddo;
If you're downloading data from Dropbox / FTP, the universe is ignored during the download and only applied once all data has been downloaded. (This is because Dropbox / FTP don't have "intelligence" to give only cases with a certain universe.) If you're doing this, your best option would be to download all the data from the server and then split it afterwards, using an approach like this:

https://www.csprousers.org/help/CSPro/s ... ction.html