Export data and reformat option

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Export data and reformat option

Post by khurshid.arshad »

I am defining an item “Food_Item” with a length of 1 digit and 5 occurrence and its shows the data in text viewer. But when I use export data then it could not export it. I am using “Multiple files options” with “As separate records” Please see attached file.


Second question: We are doing “Pakistan Rural Household Survey” and I have designed (I am using box style, colors, heading) so many forms for data entry. It will be very difficult for me to redesigned all the forms after use of reformat option. Any option that I can use my already designed forms.

I am following these steps for reformat;
1. Copy and paste dictionary in the same folder.
2. Set the length of item. Example: age length was 2 digit and I want 3 digit and more changes in other items in different records.
3. Save the dictionary and close it.
4. File new and then select “New data entry” and assign new name and press enter
5. Add amended dictionary in Input Dictionary option.
6. When I press save, this message popup
7.
8. When I enter Yes then it create forms automatically but without any formatting.

I think I am following the step. If these steps are correct then how can I use my previous formatting with new changes in data properties.

Please advise.

Regards.

arshad
Attachments
Training.rar
(3.84 KiB) Downloaded 412 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Export data and reformat option

Post by Gregory Martin »

Regarding the first question:

Sometimes exporting data from multiply occurring items is difficult. If you run your export and look at the listing file, you will probably see something like this:
W 31072 Unable to generate EXPORT' file-name
'C:\USERS\XXX\DESKTOP\TRAINING\TRAINING\DATA_1\ASSETS.TXT'
because of conflicting with another EXPORT command (seq # 2). Only
one record type is supported for this model.
This is a case when writing your own batch exports is useful. See information about how to do that here: http://www.csprousers.org/2011/12/09/si ... h-exports/

I've done that with your code, copying your export model and then modifying it so that the multiply occurring items would be exported properly:
PROC GLOBAL

NUMERIC rec_occ;
NUMERIC item_occ;

FILE file_TRAINING_REC;
FILE file_ASSETS;


PROC TRAINING_FF


PROC TRAINING_QUEST

PreProc

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

    
For rec_occ in RECORD TRAINING_REC do
        
EXPORT TO file_TRAINING_REC
        
CASE_ID(TRAINING_ID)
        TRAINING_REC;
    
Enddo;

    
EXPORT TO file_ASSETS
    
CASE_ID(TRAINING_ID)
    
//HH_MEMBERS, NUMBER_OF_ROOM, TYPE_OF_TOILET, HEAD_EDUCATION, DATE, DD, MM, YEAR;
    HH_MEMBERS, NUMBER_OF_ROOM, TYPE_OF_TOILET, HEAD_EDUCATION, DATE, DD, MM, YEAR, FOOD_ITMES; // added FOOD_ITMES here

    
// the below code is erroneously generated by CSExport; it won't work when you've already exporting to
    // file_ASSETS above; if you were only exporting FOOD_ITMES, it would work
    
    
{For item_occ in ITEM FOOD_ITMES do
        If item_occ in 1:5 then
            EXPORT TO file_ASSETS
            CASE_ID(TRAINING_ID)
            FOOD_ITMES;
        EndIf;
    Enddo;}
See attached for the program.
Attachments
exportApp.zip
(3.14 KiB) Downloaded 430 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Export data and reformat option

Post by Gregory Martin »

Regarding the second question:

The Generate Forms option will always create forms without formatting. It will create one form for each record in your dictionary. If you want to use your existing forms, you would be better off:

1) Opening your original application and making the change to the dictionary.

2) Selecting File -> Save As and saving the data entry application under a new name. Make sure to give the dictionary a new name as well.

Now you'll have a new and modified dictionary but the formats of the old forms will be intact in a new forms file.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Export data and reformat option

Post by khurshid.arshad »

Dear Gregory

Sorry in delay response because i was out of the city for survey.

Thanks for your help. This sounds good for form designing. But if we had already done 30% data entry then what will we do for form designing because we are using reformat option . Following is the procedure that i am currently adopting.


1. Close the CSPro and make the copy of dictionary in the same folder.
2. Reopen CSPro program
3. Make changes in a new dictionary
4. Then run reformat data option
5. Give old dictionary name in input option and add amended dictionary in output option
6. Give old data file(File name: Data) in input option and give new data (File name: data1)file in output option

Now i have new data file with 30% data entry with new dictionary. Following is the procedure i have adopted for using old form design with new dictionary.

7. open data entry application with "OLD DICTIONARY" not new.
8. make same changes in this dictionary and save it.
10. At this stage when i run for data entry option. i will use this dictionary instead "?New Dictionary" but with "NEW DATA FILE [Data1]" not Old one [data].

Please advise i am following the right steps or not .

Regards and take care.

Arshad
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Export data and reformat option

Post by Gregory Martin »

What you are doing will work, but in the future I would instead:

1) Open the data entry application and Save As a new name. Give new names for the data entry program, the form file, and the dictionary.
2) Make the changes to the new dictionary.
3) Run reformat to get the data from the old dictionary to the new one that you created in step 1.

That way you only have to make the changes in the dictionary once.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Export data and reformat option

Post by khurshid.arshad »

Dear Gregory

Thanks and take care.

arshad
Post Reply