I can use the "Setfile" function to assign a data file to a dictionary. I would like to know how to do this in case where I want my dictionary browses two or more files to check for a condition. for example, I wrote a loop on a household data file, draw up the list of persons eligible for a specific interview, so how to do it in the case of several data files instead of just one?
Thanks !!!!
Assign two or more data files to a dictionary
Assign two or more data files to a dictionary
Sincerely yours !
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Assign two or more data files to a dictionary
How about creating a function where you do your loop:
function RunTask(string data_filename)
setfile(DICT_NAME, data_filename);
// do something
end;
// ...
RunTask("file1.csdb");
RunTask("file2.csdb");
setfile(DICT_NAME, data_filename);
// do something
end;
// ...
RunTask("file1.csdb");
RunTask("file2.csdb");
Re: Assign two or more data files to a dictionary
I works, thanks!
But, I have a small question, if you do not mind. For synchronization, at the place to write for example: File01.csdb, file02.csdb, ..., to designate files to synchronize or even copy, I can use "* .csdb" or "file??.csdb", to designate all files in this format, I wanted to do in this case it is not working.
So, does it do not in this case or I made a mistake?
But, I have a small question, if you do not mind. For synchronization, at the place to write for example: File01.csdb, file02.csdb, ..., to designate files to synchronize or even copy, I can use "* .csdb" or "file??.csdb", to designate all files in this format, I wanted to do in this case it is not working.
So, does it do not in this case or I made a mistake?
Sincerely yours !
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Assign two or more data files to a dictionary
If you have many files for synchronization then use fileconcat Function
See my syntax
See my syntax
Code: Select all
filedelete ("..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+"*.csdb");
fileconcat(LISTING_DICT_NSER,"..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb","..\104_Data\Listing_NSER\"+"Listing-"+edit("9999999",Pro_Code)+"*.csdb");
if fileexist("..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb") then
if syncconnect(CSWeb, "http://servername IP Address/csweb7_3/api") = 1 then
setfile(LISTING_DICT_NSER, "..\104_Data\Listing_NSER\"+"ConL_"+edit("9999999",Pro_Code)+".csdb");
syncdata(PUT,LISTING_DICT_NSER);
syncdisconnect();
stop(1);
else
errmsg ("Internet connection is not working properly.");
move to Pro_Sup_ID;
endif;
else
errmsg ("You don't have listing data to send on the server.");
Move to Pro_Sup_ID;
endif;
Re: Assign two or more data files to a dictionary
Thank you for your kind answer !
Sincerely yours !
Re: Assign two or more data files to a dictionary
Usually when we work with csdb files we just a single file rather than multiple files. When using the old file based sync you ended up with one data file per interviewer or sometimes more. With csdb it is easier to just keep everything in one data file so you don't have deal with concatenating and syncing multiple files.