Page 1 of 1
TM1ViewCreateByExpression?
Posted: Tue May 13, 2014 8:45 pm
by mfritsche
Hi,
using the DependencyWalker (and working on a binding of the C-API based on the Java API Design minus the TM1V-ping pong), I found
Code: Select all
TM1ViewCreateByExpression(TM1P, TM1V , TM1V)
which I guess is similar to
Code: Select all
TM1SubsetCreateByExpression(TM1P, TM1V, TM1V)
the first TM1V being a server handle, the second one being a TM1ValString with the MDX expression.
I can easily create an example to create the expression based subsets. I haven't found any documentation how to create views by expression. Is this one just a stub? Any ideas how I could test it?
Best regards,
Markus
Re: TM1ViewCreateByExpression?
Posted: Wed May 14, 2014 12:10 pm
by rmackenzie
In early 9.x versions this was working, but as far as I know has never been documented. As I recall, the arguments are a server handle and a string value with something like 'SELECT subset ON ROWS, other_subset ON COLUMNS FROM cube WHERE titles'. The resulting object is insanely difficult to parse as contains arrays within arrays within arrays etc of values. The implementations in both the old AMOMD library and the newer .NET and Java APIs are much easier to handle. Happy to hear from anyone who handled the output from this function in a holistic way.
Re: TM1ViewCreateByExpression?
Posted: Wed May 14, 2014 7:22 pm
by declanr
rmackenzie wrote:In early 9.x versions this was working, but as far as I know has never been documented. As I recall, the arguments are a server handle and a string value with something like 'SELECT subset ON ROWS, other_subset ON COLUMNS FROM cube WHERE titles'. The resulting object is insanely difficult to parse as contains arrays within arrays within arrays etc of values. The implementations in both the old AMOMD library and the newer .NET and Java APIs are much easier to handle. Happy to hear from anyone who handled the output from this function in a holistic way.
I had a look once and got something out of it (eventually) but decided it was the devils work and the dev effort wasn't worth the result.
Re: TM1ViewCreateByExpression?
Posted: Wed May 14, 2014 8:32 pm
by mfritsche
declanr wrote:the devils work
In that case, I'll will ignore it

Re: TM1ViewCreateByExpression?
Posted: Tue Oct 31, 2017 11:10 am
by ture
What did you say about TM1ViewCreateByExpression()?
I can call TM1ViewCreateByExpression and get hNewObject.
Code: Select all
TM1ValType(hUser, hNewObject) == TM1ValTypeObject()
TM1ValObjectType(gethUser, hNewObject) == TM1TypeView()
and
Code: Select all
TM1V hParent = TM1ObjectPropertyGet(hPool, hNewObject, TM1ObjectParent())
TM1ValType(hUser, hParent ) == TM1ValTypeObject()
TM1ValObjectType(gethUser, hParent ) == TM1TypeCube()
I can get name of this cube, call :
Code: Select all
hObject=registerObject(hUser, hPool, hParent, hNewObject, "mdx_view2", vName)
and delete
Code: Select all
deleteObject(hUser, hPool, hObject)
But I can`t use this View. How to write an expression for view? And I can't find this View by name or index.
Re: TM1ViewCreateByExpression?
Posted: Fri Nov 03, 2017 4:08 pm
by ture
I can create view based on MDX query. And I can after that call this view through REST API. It works fine. But when I try to use this view from API c/c++/basic, then I have troubles. I upload all content of cube.
Code: Select all
SELECT
{ TM1FILTERBYPATTERN(TM1SUBSETALL([}Clients]),"*1e4a4f0b688ed8438c7a5c137c32309c*") } ON COLUMNS,
{ TM1FILTERBYPATTERN(TM1SUBSETALL([}Groups] ),"ADM*") } ON ROWS
FROM [}ClientGroups]
and ny code:
Code: Select all
*//cube by name
TM1V hCube = TM1ObjectListHandleByNameGet(hPool, hServer, TM1ServerCubes() , TM1ValString(hPool, "}ClientGroups" , 0));
//view by name
TM1V hView = TM1ObjectListHandleByNameGet(hPool, hCube , TM1ValIndex(hPool, 357), TM1ValString(hPool, "mdx_View_last8", 0));
//extract data from view
TM1V hExtractList = TM1ViewExtractCreate(hPool, hView);
TM1V hExtract = nullptr;
while (nullptr != (hExtract = TM1ViewExtractGetNext(hPool, hExtractList))) {
if (TM1ValType(hUser, hExtract) == TM1ValTypeError())
std::cerr << "Oops\n";
TM1_INDEX ind = TM1ValType(hUser, hExtract);
if (ind == TM1ValTypeIndex()) {
TM1_INDEX n = TM1ValIndexGet(hUser, hExtract);
if (n > 0)
std::cout << n << std::endl;
else
break;
}else if (ind == TM1ValTypeString())
std::cout << TM1ValStringGet(hUser, hExtract) << std::endl;
else if (ind == TM1ValTypeReal())
std::cout << TM1ValRealGet(hUser, hExtract) << std::endl;
else
std::cerr << "Oops 2\n";
}*
Where is wrong?