TM1ViewCreateByExpression?

Post Reply
mfritsche
Posts: 4
Joined: Tue May 13, 2014 8:38 pm
OLAP Product: TM1
Version: 2.0.6
Excel Version: 2016

TM1ViewCreateByExpression?

Post 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
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: TM1ViewCreateByExpression?

Post 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.
Robin Mackenzie
declanr
MVP
Posts: 1815
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: TM1ViewCreateByExpression?

Post 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.
Declan Rodger
mfritsche
Posts: 4
Joined: Tue May 13, 2014 8:38 pm
OLAP Product: TM1
Version: 2.0.6
Excel Version: 2016

Re: TM1ViewCreateByExpression?

Post by mfritsche »

declanr wrote:the devils work
In that case, I'll will ignore it :twisted:
ture
Posts: 9
Joined: Sat Oct 21, 2017 11:40 am
OLAP Product: tm1
Version: 10.2
Excel Version: 2013

Re: TM1ViewCreateByExpression?

Post 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.
ture
Posts: 9
Joined: Sat Oct 21, 2017 11:40 am
OLAP Product: tm1
Version: 10.2
Excel Version: 2013

Re: TM1ViewCreateByExpression?

Post 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?
Post Reply