Downloading per Province in CSWeb

Other discussions about CSPro
Post Reply
YFT_CBSD
Posts: 65
Joined: January 3rd, 2023, 12:36 am

Downloading per Province in CSWeb

Post 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
YFT_CBSD
Posts: 65
Joined: January 3rd, 2023, 12:36 am

Re: Downloading per Province in CSWeb

Post 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.
Gregory Martin
Posts: 1948
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Downloading per Province in CSWeb

Post 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
Post Reply