|
<< Click to Display Table of Contents >> Copying etc. |
![]() ![]()
|
As mentioned in the user guide section on databanks, Gekko databanks can contain different types of variables. Such variables may be copied, rename, moved, etc. between databanks, cf. the following statements:
Makes the Ref (reference) databank an exact copy of the first-position databank. The statement is often used for modeling, but can also be used for data management, when comparing two databanks. |
|
Copies variables inside a databank or between databanks. COPY copies all observations of timeseries, unless COPY<respect> is used. Wildcards and ranges can be used. |
|
Deletes variables in a databank (by name or wildcards/ranges) |
|
Searches a databank for variables (with wildcards or ranges). Can also search inside array-series. |
|
Renames variables in a databank (by name or wildcards/ranges). Can also be used to move variables between databanks (without copying). |
In general, regarding statements like the above, it should be noted that a seemingly all-encompassing wildcard like * will only match timeseries of the current frequency in the first-position databank. If you need, for instance, to match all timeseries (of the current frequency) in all databanks, use *:*, and to match all timeseries of all frequencies (in the first-position databank), use *!*. There are also special rules regarding matching of scalars and maps, cf. this page on wildcards.
Some examples:
copy x1 to x2; //make x2 an exact copy of x1 |
As with other statements, it should be remembered that copy #m1 to #m2; will copy the object #m1 itself (#m1 may or may not be a list) into the object #m2, whereas copy {#m1} to {#m2}; will copy the variables corresponding to the string names inside #m1 (#m1 must be a list) into the variables corresponding to the string names inside #m2.
About wildcards, there are some special rules regarding these in relation to the symbols %, #, and !, cf. the user guide page on lists (or a more detailed explanation of wildcard logic here).
The DELETE statement just deletes named variables in a databank, for instance:
delete x1, x2, x3; |
RENAME has the same syntax as COPY, and the only difference between the two is that COPY clones objects/variables, whereas RENAME renames/moves them. For instance:
rename x1, x2 as y1, y2; //renaming two variables rename b1:x1 as b2:x1; //moving the variable between banks |
The INDEX statement searches for variables and returns the results as a list of string names. See more about INDEX on the user guide page on lists. Beware that the keys [Tab] or [Ctrl+Space] offer autocompletion on timeseries names (cf. here).