Page 1 of 1

Checking of SQL field against dimension

Posted: Fri Apr 16, 2010 5:20 am
by appleglaze28
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.

Re: Checking of SQL field against dimension

Posted: Fri Apr 23, 2010 10:36 am
by jstrygner
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