Page 1 of 1

specifying where clause in sync pff file?

Posted: December 3rd, 2020, 9:04 am
by Anne
After data collection, our data needs to be managed in various local offices, so I made a desktop application which (amongst other stuff) runs a pff file to download data from the csweb server.

My challenge is that the data is confidential, so I only want to download the data relevant for the given local office, but I can't find documentation anywhere that it is possible to download/sync data by specifying the cases you want. This would also come in handy as the amount of data grows (this is a monthly survey going on forever, hence file sizes will probably become a problem sooner or later)

Any suggestions on how to deal with this?

(My not-so-elegant solution is to copy the relevant data to another csdb file right after downloading, and then delete the downloaded file)

Re: specifying where clause in sync pff file?

Posted: December 3rd, 2020, 9:18 am
by htuser
Hi Anne,
Have you looking for using universe with sync? https://www.csprousers.org/forum/viewtopic.php?t=2467
This could help you.
However, actual universe lack of flexibility. It's why months ago, Greg think to give us a better way, something that combines CSPro and SQL like this:

syncdata(PUT or GET, SURVEY_DICT where .... = x and ...= y);

But it's not implemented yet.

If multiples users request it, maybe, we may have it quickly.

Re: specifying where clause in sync pff file?

Posted: December 3rd, 2020, 9:25 am
by Anne
thank you, htuser
This would be a great way of doing it had it been implemented :D

My method was just to run the pff file that is generated when you click on the download icon on csweb.. and I wamted to add parameters to that file, but your suggestion is much more general and usable..

Let's cross fingers that it will be implemented..

Anne

Re: specifying where clause in sync pff file?

Posted: December 3rd, 2020, 12:32 pm
by aaronw
If your case ids specify the local office, then the sync universe would be perfect. Notice that syncdata takes a optional parameter sync_universe:
https://www.csprousers.org/help/CSPro/s ... ction.html

A few paragraphs down the use is explained. Ideally, you could specify a particular local office. For instance, if you wanted to download cases for the office specified by REGION 01, WARD 02, EA 007, OFFICE 001 it would look like:
string officeUniverse = maketext("%v%v%v%v", REGION, WARD, EA, OFFICE);
syncdata(GET, SURVEY_DICT, officeUniverse);
At the least you could limit the data downloaded to a geographically area:
string officeUniverse = maketext("%v%v%v", REGION, WARD, EA);
syncdata(GET, SURVEY_DICT, officeUniverse);

Re: specifying where clause in sync pff file?

Posted: December 3rd, 2020, 4:44 pm
by noel
Hi Aaronw,

It would be a good think to be able to use a where clause with sync statement.

I hope it will be implemented quickly.

Noël

Re: specifying where clause in sync pff file?

Posted: December 4th, 2020, 5:30 am
by Anne
Aaronw,
this helps a lot, thank you..
Now I only need some wild cards in the middle and it'd be perfect :)