-
Notifications
You must be signed in to change notification settings - Fork 20
transferVariable
Function for transfering an OpenSHAPA variable from one OpenSHAPA database to another. You can also select whether or not the variable should be removed from the original database upon transfer.
This is useful for reducing the size of large OpenSHAPA database files by moving columns into separate files, or breaking up a file so two coders can work on different columns at the same time. The files can then be merged back together.
The database we want to transfer a variable FROM.
If a blank string is passed to this variable (""
), then the database that is currently
in $db
(i.e., the currently opened database) will be used.
The database we want to transfer a variable TO.
If a blank string is passed to this variable (""
), then the database that is currently
in $db
(i.e., the currently opened database) will be used.
Whether or not the variable will be deleted from the source database upon successful transfer. If something breaks in the function before a transfer is completed, the variable will not be deleted. NOTE: Use with caution.
The names of the variables to transfer from the source to the target DB. You can list as many as you like, as long as they all exist in the source database.
Nothing.
# Set up the strings to the database files
source_db = File.expand_path("~/Desktop/source.opf")
target_db = File.expand_path("~/Desktop/target.opf")
# The source file above contains two columns we want to transfer:
# trial and condition. Move both of these to the target file and DO NOT delete them
# upon move.
transferVariable(source_db, target_db, false, "trial", "condition")