Checking of SQL field against dimension
-
- Regular Participant
- Posts: 269
- Joined: Tue Apr 21, 2009 3:43 am
- OLAP Product: Cognos TM1, Planning
- Version: 9.1 SP3 9.4 MR1 FP1 9.5
- Excel Version: 2003
Checking of SQL field against dimension
I have this process where I'm looking up at a specific table in SQL whether the element in a TM1 dimension exist in that SQL table or not. Cause if such element is available in SQL, I will have to change the security from WRITE TO READ. I was able to do the security...but rather than getting errors on the field elements of SQL not being found on the TM1 dimension, I just want those items ignore and just proceed to the next error and get a process complete output rather than an error.
-
- MVP
- Posts: 195
- Joined: Wed Jul 22, 2009 10:35 pm
- OLAP Product: TM1
- Version: 9.5.2 FP3
- Excel Version: 2010
Re: Checking of SQL field against dimension
If I understand correctly, you have a TI process that as a source uses a table in relational database (let's say 'DIM_PRODUCTS'), you also have a TM1 dimension with elements that occur in that table (let's say 'TM1_Products_dim').
Let's say table 'DIM_PRODUCTS' looks like this:
ID,NAME
1,Prod1
2,Prod2
3,Prod3
Let's say dimension 'TM1_Products_dim' looks like this:
Total Products
- Prod2
- Prod4
First in the prolog tab you iterate with While through all elements in Total Products and give them 'WRITE' right to the group(s) you want (I assume if something is not in the 'DIM_PRODUCTS' security should be on 'WRITE' level).
Now what you need to do is in Data tab of TI process you Check if name from NAME column exists in the dimension and if it does you change the right to 'READ'.
Sample code:
If(DimIx('TM1_Products_dim', NAME_COLUMN_VALUE)>0)
ElementSecurityPut('READ', 'TM1_Products_dim', NAME_COLUMN_VALUE, GROUP_YOU_WANT);
EndIf;
This way you will not try to assign security to elements in 'TM1_Products_dim' that are not there.
HTH
Let's say table 'DIM_PRODUCTS' looks like this:
ID,NAME
1,Prod1
2,Prod2
3,Prod3
Let's say dimension 'TM1_Products_dim' looks like this:
Total Products
- Prod2
- Prod4
First in the prolog tab you iterate with While through all elements in Total Products and give them 'WRITE' right to the group(s) you want (I assume if something is not in the 'DIM_PRODUCTS' security should be on 'WRITE' level).
Now what you need to do is in Data tab of TI process you Check if name from NAME column exists in the dimension and if it does you change the right to 'READ'.
Sample code:
If(DimIx('TM1_Products_dim', NAME_COLUMN_VALUE)>0)
ElementSecurityPut('READ', 'TM1_Products_dim', NAME_COLUMN_VALUE, GROUP_YOU_WANT);
EndIf;
This way you will not try to assign security to elements in 'TM1_Products_dim' that are not there.
HTH