Page 1 of 1

Export Data with UUID

Posted: July 1st, 2025, 5:22 am
by YFT_CBSD
Hello Everyone,

is there a way to export data with uuid? instead of case_id it will be uuid or caseid+uuid.

Thanks.

Re: Export Data with UUID

Posted: July 1st, 2025, 8:08 am
by Gregory Martin
You can do this in a batch export application but not using the Export Data tool. If you haven't used a batch export before, what you can do is:

1) Open your export specification in Export Data.
2) Select View -> Batch Logic.
3) Click Create Batch Application.

Once you've done this, you'll have a batch export application that exports the data you're interested in. For example, I did this with the Popstan Census dictionary and I get this:
PROC GLOBAL

FILE
cspro_export_file_var_f;

PROC QUEST

PreProc

    set
behavior() export (CommaDelim, ItemOnly, ANSI);

    EXPORT TO cspro_export_file_var_f
    CASE_ID(PROVINCE, DISTRICT, VILLAGE, EA, UR, BUILDING, HU, HH)
    PERSON, HOUSING;
The next step is that you have to add a dictionary item that will contain the UUID. I'll do this using a working storage dictionary:

1) Select File -> Add Files.
2) Click on "Working Storage Dictionary..."
3) Edit the dictionary, adding an item to WS_REC, CASE_UUID, alpha, length 36.

Then I modify the logic to set this value, and to export it:
    CASE_UUID = uuid(CEN2000);
   
    EXPORT TO cspro_export_file_var_f
    CASE_ID(PROVINCE, DISTRICT, VILLAGE, EA, UR, BUILDING, HU, HH)
    CASE_UUID, PERSON, HOUSING;
Now when you run this application, you'll get the UUID in the export.

Re: Export Data with UUID

Posted: July 1st, 2025, 10:27 pm
by YFT_CBSD
Its working, Thanks Greg!

Re: Export Data with UUID

Posted: July 13th, 2025, 2:28 am
by YFT_CBSD
Hi Greg,

I have a question. For example, I have a single .csdb file that contains data for multiple cities/municipalities, and I want to extract the text files separately by city/municipality.

Example:
Input: 01.csdb
Output:
01/01001/cspro_export_file_var_f.txt
01/01002/cspro_export_file_var_f.txt
01/01003/cspro_export_file_var_f.txt
01/01004/cspro_export_file_var_f.txt
01/01005/cspro_export_file_var_f.txt

Thanks

Re: Export Data with UUID

Posted: July 14th, 2025, 5:40 pm
by savy
You can use setoutput function in a batch application to split the contents of the input data file into one file for each city code;
https://www.csprousers.org/help/CSPro/s ... ction.html

Re: Export Data with UUID

Posted: August 26th, 2025, 9:36 pm
by YFT_CBSD
Tried the setoutput but when multiple records are set, the output is directed only in a single record, all other records are blanks. Thanks

Re: Export Data with UUID

Posted: August 27th, 2025, 12:27 pm
by savy
Your logic is not quite right. To get the correct logic, use CSExport tool and set your options correctly. Then click on View->Batch Logic to get the correct logic and paste it into your batch application as Greg mentioned below. For comma delimited export, if you do not want it in a single record, choose "Multiple Files" option and "As separate records"