Hi guys how are you? Did you guys ever tried to automate the process of coping a cube outline from one application to another?
Well, there’s an easy way to do that. Basically you copy the .otl from the server file system over the other cube. The problem is that if the cube is not empty, the database becomes corrupted since we just replaced an .otl file for another strange .otl file (no restructure happened).
Then if you want to copy the outline to an existing cube (that has data) this is not a solution.
The thing is, the only two possible ways to do what we want is the EAS “Save as” operation and the migration wizard. These both operations work because they copy the .otl file as .otn and then run a restructure in the database. The restructure “synchronize” the cube with the new outline, making the process safe for a cube that has data on it.
The problem is, none of these can be automated and there’re no way to do this operation using Maxl or EssCmd.
In fact, even using the Java API, it’s hard to figure out how to do that because all the copy methods seem to copy all kind of objects but the outline.
The good news is, we figured out a way to replicate the “Save as” operation using the Java API after hours of frustration and tears…
Here we go:
The code is really simple. We need to connect in the essbase server, lock the target outline (the one we’ll overwrite) and then copy the outline from one application to another. To do that we are going to use the functions “lockOlapFileObject” and “copyOlapFileObjectToServer”.
This process that we just described will create an .otn file in the target cube. Now comes the great catch of this code (that is not documented anywhere):
If we open the target outline in EAS we will still see the old metadata. To commit the changes, we need to perform a restructure to merge the new outline (.otn) with the old one (.otl) updating the metadata.
To do that we are going to use the functions in the class “IEssCubeOutline” to “open”, “restructureCube” and “close” the target outline.
That is it. This process will do exactly what the “Save As” in EAS does, which means that you can copy outlines from one application to another even when the target database contains data.
I hope you guys enjoy and see you soon.