Locking an element using TI

Post Reply
User avatar
Chengooi
Posts: 64
Joined: Tue Jan 13, 2009 7:46 am
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Auckland, New Zealand
Contact:

Locking an element using TI

Post by Chengooi »

I have searched thru TI Help to find out if there is any syntax to lock an element or elements using TI nothing specific to what I am after, does anyone know?

The one in Help requires security grouping but really what I am after was having to be able to send a parameter using TI specifying what element to lock and "bang" it's locked! :o
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
David Usherwood
Site Admin
Posts: 1457
Joined: Wed May 28, 2008 9:09 am

Re: Locking an element using TI

Post by David Usherwood »

I don't believe this is available - wish it were.
I use rules in cell security cubes, driven by (normal) control cubes. I've read suggestions that cell security gives a performance hit but I think this is manageable if the rules therein are kept simple.
glaurens
Posts: 41
Joined: Thu Jan 08, 2009 3:42 pm

Re: Locking an element using TI

Post by glaurens »

This works, and as you can see, I used the planning sample database, add a few additional parameters, and Bob's your uncle...

Prolog tab:

cubelockoverride(1);

if(lock = 1);
cellputs('admin', '}elementproperties_plan_time', 'JAN-2004', 'lock');
else;
cellputs('', '}elementproperties_plan_time', 'JAN-2004', 'lock');
endif;



G
David Usherwood
Site Admin
Posts: 1457
Joined: Wed May 28, 2008 9:09 am

Re: Locking an element using TI

Post by David Usherwood »

Nice one.
Cubelockoverride is in the list of reserved words but is _not_ (from a brief check) documented in the (9.1) help. Which version are using, and is it documented in that version?
Update - found it in the 9.0 documentation. Think it disappeared when they tore up the locking model for 9.1+. However most of our clients are on 9.0 so very relevant.
User avatar
Chengooi
Posts: 64
Joined: Tue Jan 13, 2009 7:46 am
OLAP Product: TM1
Version: 9.4
Excel Version: 2003
Location: Auckland, New Zealand
Contact:

Re: Locking an element using TI

Post by Chengooi »

Hi Glaurens

I have tried your code :

cubelockoverride(1);

if(lock = 1);
cellputs('admin', '}elementproperties_plan_', 'JAN-2004', 'lock');
else;
cellputs('', '}elementproperties_plan_time', 'JAN-2004', 'lock');
endif;

I could not saved the TI process as it keep prompting the variable lock undefined, then I went on to define teh variable and it does not allow me to saved, do you have a sample of what /how lock shoudl be define?

also just the line cubelockoverride(1);
it run successfully, but how does it know which cube and element to lock?
The most wasted of all days is one without laughter.
e e cummings (1894-1962)
roy2087
Posts: 40
Joined: Wed Feb 06, 2013 9:53 am
OLAP Product: cognos tm1
Version: 10.1.1
Excel Version: 2007
Location: Bangalore,India

Re: Locking an element using TI

Post by roy2087 »

To Lock an Element (Version Element).

Step 1 :
Data Source Tab:
Cube View [}ElementProperties_0v_Version->Default]

Step 2 :
Variable Tab

vVersion -> String -> Other
vMode -> String -> Other
Value -> String -> Other

Step 3 :
Parameters Tab

pVersion -> String

Step 4 :
Prolog Tab

vMode = 'LOCK';
cellputs('admin', '}elementproperties_0v_Version',pVersion,vMode);

To UnLock an Element (Version Element).

Step 1 : Same as Lock Version.
Step 2 : Same as Lock Version.
Step 3 : Same as Lock Version.

Step 4 :
Prolog Tab

cubelockoverride(1);

vMode = 'LOCK';

Unlock_Version = CellGetS( '}elementproperties_0v_Version',pVersion,vMode);

IF
(
Unlock_Version @= 'Admin'
);
CellPutS('', '}elementproperties_0v_Version',pVersion,vMode);
ENDIF;
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Locking an element using TI

Post by lotsaram »

roy2087 it makes no sense to use a cube view as data source to lock/unlock an element. To make the process generic datasource should be NONE you just need 3 parameters; dimension, element and lock or unlock.

All code can be on the prolog, you can test for the existence of the }ElementProperties_<dimension> cube and if it doesn't exist then create it before doing any CellPutS.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
roy2087
Posts: 40
Joined: Wed Feb 06, 2013 9:53 am
OLAP Product: cognos tm1
Version: 10.1.1
Excel Version: 2007
Location: Bangalore,India

Re: Locking an element using TI

Post by roy2087 »

Hi lotsaram ,

Thanks for the advice.
I have made the necessary changes in my TI process.

Modified TI Code for Locking an element(Version Dimension) is as follows:-

Datasource Tab -> None
Advanced tab -> Parameters Tab -> pVersion (String)

Prolog Tab (Code Below)

IF
(
CubeExists('}elementproperties_0v_Version') = 1
);
Check_Version = CellGetS('}elementproperties_0v_Version',pVersion,vMode);
else;
CubeCreate('}elementproperties_0v_Version','0v_Version','}ElementProperties');
ENDIF;

IF
(
Check_Version @= 'Admin'
);
cubelockoverride(1);
CellPutS('admin', '}elementproperties_0v_Version',pVersion,vMode);

ELSE;
CellPutS('admin', '}elementproperties_0v_Version',pVersion,vMode);

ENDIF;
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: Locking an element using TI

Post by BariAbdul »

Code: Select all

ELSE;
CellPutS('admin', '}elementproperties_0v_Version',pVersion,vMode);

ENDIF;
I think admin should be blank '' after else.Thanks
"You Never Fail Until You Stop Trying......"
roy2087
Posts: 40
Joined: Wed Feb 06, 2013 9:53 am
OLAP Product: cognos tm1
Version: 10.1.1
Excel Version: 2007
Location: Bangalore,India

Re: Locking an element using TI

Post by roy2087 »

Hi Bari Abdul ,

Explanation is as follows:-

*************************************************************************************************************************
#This code is used to get the current status of the version element.
#To get the intersection value in the cube.
IF
(
CubeExists('}elementproperties_0v_Version') = 1
);
Check_Version = CellGetS('}elementproperties_0v_Version',pVersion,vMode);
else;
CubeCreate('}elementproperties_0v_Version','0v_Version','}ElementProperties');
ENDIF;

#If , the intersection is 'Admin' and if the user has entered 'Admin' in the Parameter
#(pVersion) then execute the If - Statement.

IF
(
Check_Version @= 'Admin'
);
cubelockoverride(1);
CellPutS('admin', '}elementproperties_0v_Version',pVersion,vMode);

#Else , the Intersection has returned Blank('') , then WRITE 'Admin' in the Interection .

ELSE;
CellPutS('admin', '}elementproperties_0v_Version',pVersion,vMode);

ENDIF;


*************************************************************************************************************************


Regards,
Roy.
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: Locking an element using TI

Post by BariAbdul »

Thanks Roy.
"You Never Fail Until You Stop Trying......"
jduplessis
Posts: 19
Joined: Tue Sep 16, 2014 11:51 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010
Location: Ottawa, Canada

Re: Locking an element using TI

Post by jduplessis »

I've used the same approach as listed in this thread however, I'm having some odd behavior.

As and Admin and Data Admin running the TI locks or unlocks the version as expected. But running the TI as a member of a group that is not Admin or Data Admin causes the value in the element properties cube to toggle but the version does not actually unlock.

We've tried unlocking the Security Access property of the TI but this seems to have no affect. Any ideas?
Post Reply