SaveAs method: Tree class
Syntax
SaveAs(SetID, UserKeyValue, TreeName, EffDt, BranchName)
Description
The SaveAs method writes any changes to the tree executing the method to the new tree specified with the parameters. It also performs audits.
The tree specified with the parameters must be a new tree. You receive an error if the tree already exists. The new tree must have at least one different key field from the original tree.
The SaveAs method automatically closes the tree that is associated with the tree object executing the method, and associates that tree object with the new tree. Any changes made to the original tree since the last time the tree was saved are discarded. For example, suppose you opened a tree named DEPENDENT_BENEF and associated it with the variable &MYTREE. If you executed the SaveAs method with &MYTREE, changing the name to DEPENDENT_BENEF2, &MYTREE would now be associated with DEPENDENT_BENEF2, and the original tree, DEPENDENT_BENEF, would be closed.
&MYTREE.Open("", "", "DEPENDENT_BENEF", "02-02-1999", "", False);
/* do some processing */
&MYTREE.SaveAs("", "", "DEPENDENT_BENEF2", "02-05-1999", "");
&MYTREE is now associated with DEPENDENT_BENEF2, not with the original open tree.
Note:
If you’re calling the Tree API from an Application Engine program, the data won’t actually be committed to the database until the Application Engine program performs a COMMIT.
Parameters
| Parameter | Description |
|---|---|
|
SetID |
Specify the table indirection key for the tree. This parameter takes a string value. If the tree structure the tree is based on has its IndirectionMethod specified as "S", you must specify a SetID. If the tree structure doesn’t have its IndirectionMethod specified as "S", you must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter. |
|
UserKeyValue |
Specify the User Key Value for the tree. This parameter takes a string value. If the tree structure the tree is based on has its specified as "U" or "B", you must specify a User Key Value. If the tree structure doesn’t have its IndirectionMethod specified as "U" or "B", you must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter. |
|
TreeName |
Specify the name for this tree. This parameter takes a string value. |
|
EffDt |
Specify the effective date for this tree. This parameter takes a string value. |
|
BranchName |
This parameter is required, but it is unused in this release. You must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter. |
Returns
This method returns an integer: 0 if saved successfully, a number greater than 0 otherwise.
Example
&MYTREE.SaveAs("", "", "DEPENDENT_BENEF2", "02-05-1999", "");