Motyl wrote:I have same problem with truncating an array:
Code: Select all
long[] elementArray = new long[2];
int a =TM1API.TM1ObjectListHandleByNameGet(hPool, hServer,TM1API.TM1ServerDimensions(), TM1API.TM1ValString(hPool, "Sklepy", 100));
int b = TM1API.TM1ObjectListHandleByNameGet(hPool, a, TM1API.TM1DimensionElements(), TM1API.TM1ValString(hPool, "101", 100));
int c = TM1API.TM1ObjectListHandleByNameGet(hPool, hServer, TM1API.TM1ServerDimensions(), TM1API.TM1ValString(hPool, "Miara - Parametry ATS dla Salonow", 100));
int d = TM1API.TM1ObjectListHandleByNameGet(hPool, c, TM1API.TM1DimensionElements(), TM1API.TM1ValString(hPool, "Aktywny", 100));
elementArray[0] = b;
elementArray[1] = d;
int hCube = TM1API.TM1ObjectListHandleByNameGet(hPool, hServer, TM1API.TM1ServerCubes(),TM1API.TM1ValString(hPool, "Salony ATS", "Salony ATS".Length ));
MessageBox.Show(elementArray.Length.ToString()); -- Two
int hEACapsule = TM1API.TM1ValArray(hPool, ref elementArray, 2);
MessageBox.Show(elementArray.Length.ToString()); -- One
I've split this off from my
Connecting To TM1 Using VB.Net and the *CLASSIC* API post for multiple reasons. First, I don't want it becoming a "catch all" thread for any API related questions. Second it's way,
way off topic since I made it clear at the outset that while I may dabble in it occasionally, I don't "do" C#. The post was about VB.Net. And the code above is
NOT VB.Net, as one glimpse at the array operators tells us.
I have no idea what you're trying to achieve above, but as to your specific question my guess, bearing in mind again that I haven't used the C side of the API operationally including this specific function, would be this part of the documentation:
The function returns the handle to the array value capsule created. The array has no values. You must add values to the array with the function TM1ValArraySet.
Putting the handles that you derive from TM1ObjectListHandleByNameGet into the array elements before you call TM1ValArray ain't quite the same thing, I think.