I'm newer to Java. I'm running Eclipse version Kepler, and connecting successfully to TM1 9.5.2.
I'm able to:
1. establish a connection
2. Connect to a particular cube
3. Extract a single value out of the cube using the sample code that IBM has provided in the installation > sample code folder
The ultimate goal is to pull a view of data from the TM1 cube, take the data in that view and convert it into XML.
As stated above, I can pull a single value out of the cube using the "getCellValue()" method. However, I don't want to just pull an individual cell, one at a time. I'm wanting to:
1. Open a particular view
2. Use that view as a reference to cycle through and extract the data values in the cube (or convert the view into an array, which would be better)
3. Ultimately convert all of the view data into an XML like structure.
I'm stuck on #2. Looking at the TM1 Java API documentation (or lack thereof ), here's a block of code that I'm experimenting with:
Code: Select all
TM1Cube oCube; TM1View view; TM1Val arr; TM1Val ret; view = oCube.getView("JavaTest"); view.constructArray(); //System.out.println(arr.getBoolean()); System.out.println(view.getNumberOfArrayColumns()); System.out.println(view.getNumberOfArrayRows()); System.out.println(view.getString().toString()); System.out.println(view.getArraySize()); ret = view.getArrayValue(0,0); System.out.println(ret.getInt()); ret = view.getArrayValue(1,1); System.out.println(ret.getInt());
I'm successfully pulling the view object from the TM1 cube. However, once I have the object, I'm not sure what to do with it.
I've experimented with the view.constructArray() method, but not clear on what it does. I receive a "true" value back, which indicates that it did *something*.
The "getNumberofArrayColums()" and "getNumberOfArrayRows()" return "10" and "7" respectively, so I'm assuming that it's loaded something.
How do I retrieve the information out of the array? What does the "constructArray() actually do?
Any thoughts would be helpful! Sample code of extracting data from TM1 cubes other than the sample IBM provided would be awesome.