Page 1 of 1

convert string to code TM1

Posted: Sat Nov 19, 2022 6:43 am
by mrdauduong
Hi community,

Iam looking for an idea. :!:

I have a client who have 53 cubes that use the dimension Version

I have to dev something that copie a version to another version for all the cubes.

Right now, the only solution i have is make 53 processus copy for each cube and 1 process MASTER to execute this 53 processus copy.

Another idea that i can thing about is make something "auto code" but i dont know how to make a string variable become the code TM1

For exemple

CubeName ='XXX';
CodeTM1= 'cellput('&CubeName&'.....&')'; ==> but how to make CodeTM1 work?

Is there another solution that can solve my case? :mrgreen:

Thanks a lot !

Re: convert string to code TM1

Posted: Sat Nov 19, 2022 2:16 pm
by David Usherwood
That's the easy bit - because the cube name is just a string:

Code: Select all

CubeName ='XXX';
cellputn(cubename, v1,v2....vnn);
However I think you are hoping to build a complete cellputn statement. That's not possible in pure TI code. You could do it in TM1PY using tm1.processes.update_or_create though.

Re: convert string to code TM1

Posted: Sun Nov 20, 2022 4:09 am
by Alan Kirk
Another way might be to use the Bedrock library, where most of the code has been built for you. Specifically, the }bedrock.cube.data.copy process.

Re: convert string to code TM1

Posted: Sun Nov 20, 2022 6:03 am
by mrdauduong
Alan Kirk wrote: Sun Nov 20, 2022 4:09 am Another way might be to use the Bedrock library, where most of the code has been built for you. Specifically, the }bedrock.cube.data.copy process.
thanks, it is the thing i need for now !!!
David Usherwood wrote: Sat Nov 19, 2022 2:16 pm That's the easy bit - because the cube name is just a string:

Code: Select all

CubeName ='XXX';
cellputn(cubename, v1,v2....vnn);
However I think you are hoping to build a complete cellputn statement. That's not possible in pure TI code. You could do it in TM1PY using tm1.processes.update_or_create though.
thanks, i will try it in the future