Initialization Blocks and Variables in 11G

I'm trying to set up an Initialization Block and Variable so my dashboard data can be filtered by User.
I did the following, but all the data is still being shown (instead of the data being filtered).
- In my Repository I went to Manage - Variables
- Under Session I created a variable 'VAR_EMPLOYEE_NUMBER'
- Under Intialization Blocks I created 'INIT_VAR_EMPLOYEE_NUMBER' and set variable target as 'VAR_EMPLOYEE_NUMBER'
- I added the following SQL:
select A.employee_number
from staff A, sis_user B
where B.fk_staff = A.pk_id
and B.user_name = upper(':USER')
- When I hit the 'Test' button (offline mode). I put in the value on the USER and it returns me the appropriate employee_number, so I believe my SQL and connection info is correct.
Am I missing something?

As a test, I tried to add the filter to the individual user first. In the Repository I went under Manage-Identity. Clicked on my User and hit permissions button.
I created the filter of:
"Testing and Assessments"."Student SOL Testing"."Teacher Employee Number" = VALUEOF(NQ_SESSION."VAR_EMPLOYEE_NUMBER")
That didn't work. I still see all data when I log in as that user. If I hard-code it to the users Employee Number (see below), it does work. What now?
"Testing and Assessments"."Student SOL Testing"."Teacher Employee Number" = '19983758'

Similar Messages

  • Session variable and initialization block issues

    We are using OBIEE 10.1.3.3 and utilizes built in security features. (No LDAP or other single sign on). The user or group names are not stored in any external table. I have a need to supplement Group info of the user to the usage tracking we implemented recently as the NQ_LOGIN_GROUP.RESP column contains username instead of group name. So I created a session variable and associated with a new initialization block and also had a junk default value set to the variable. In the initialization block, I wrote the following query and as a result it inserted correct values into the table when the TEST button was clicked from the initialization block form.
    insert into stra_login_data (username, groupname, login_time) values ('VALUEOF(NQ_SESSION.USER)', 'VALUEOF(NQ_SESSION.GROUP)', SYSDATE)
    My intention is to make this execute whenever any user logs on. The nqserver.log reports the following error and it doesn?t insert values into the table.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.USER, has no value definition.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.GROUP, has no value definition.
    When I changed the insert statement as below, this does get populated whenever someone logs in. But I need the values of GROUP associated with the user as defined in the repository.
    insert into stra_login_data (username, groupname, login_time) values ('TEST_USER', TEST_GROUP', SYSDATE)
    Could someone help me out! As I mentioned above, I need the GROUP info into the usage tracking. So, if there is another successful approach, could you please share?
    Thank you
    Amin

    Hi Amin,
    See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3376946&#3376946]. You can't use the GROUP session variable in an Init Block unless it has been seeded from an Init Block first. There isn't an easy solution for what you want, but here are some options:
    1) Create a copy of your User => Groups assignments in your RPD in an table so you can use it in your Usage Tracking Subject Area. But this means you will have to replicate the changes in two places so it's not a good solution.
    2) As the GROUP session variable is populated when you login you could theoretically use it a Dashboard and pass it a parameter to write the value to the database. But as I am not sure how can you make fire only once when the user logins it sounds like a bad idea.
    3) Move your User => Groups assignments from your RPD to a DB table. Use OBIEE Write Back or something like Oracle APEX to maintain them.
    I think 3) is the best solution to be honest.

  • Anonymous Block with Variable and SELECT

    Hi Guys,
    I am struggling to connect the material I am learning. I read about anonymous blocks and variables so I want to write a
    nice and neat select with all the fancy stuff (variables, exceptions) to get it right and to it as I read in the book.
    DECLARE
    MYSTRING VARCHAR(10);
    MYSTIRNG := 'X';     
    BEGIN
    SELECT * FROM DUAL WHERE DUMMY = MYSTRING
    END;
    but....this causes one error after the other. Am I getting the concept wrong here or is it a syntax error?

    cant I just get the result without using variable to store the result in the first place???Perhaps you're better off using a REF CURSOR (a.k.a. cursor variable).
    That way you'll pass a resultset to the caller and you don't need any variables to select into.
    You can read about them here:
    http://www.oracle-base.com/articles/misc/UsingRefCursorsToReturnRecordsets.php
    Re: PL/SQL 101 : Understanding Ref Cursors
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/tdddg_subprograms.htm#TDDDG99939

  • HOW TO FIND UNUSED initialization blocks  IN OBIEE RPD

    Hi Gurus,
    I have a task to remove unused initialization blocks and subject areas from RPD.
    how to find them ?how to check whether any reports are using these initialization blocks?
    Please reply me. I need to complete this task.Pls help me
    Regards,
    siva

    Unused Subject Areas -
    Use Catalog Manger - Tools - Create a report to with report name and subject area. You will get what are being used.
    Use RPD - Tools - Utilities export your RPD to CSV and check the Subject area.
    Compare both and remove unwanted subject areas.
    Initialization Blocks - We do not use these blocks directy but use Variables that are associated with it. Go to RPD - online - Mangesession - You will see the Variables tab in the window which give list of all variables thats get initialised with the session. --- Session Blocks
    Use Report Tools - Query Repository for searching.
    Try like this.

  • OBIA 7.9.6.3. Initialization Block

    Hello All,
    I have installed OBIEE11g (11.1.1.5.) and configured OBIA 7.9.6.3.. I am using Oracle Data Warehouse(Database Source) and warehouse tables exists under this node. Out of the Box OBIA has two connection pool
    1. Oracle Data Warehouse Connection Pool
    2. Oracle Data Warehouse Repository Initblocks Connection Pool
    I have standalone OBIA / OBIEE install and data is source from Oracle Ebusiness suite 12.1.3 and Siebel 8.1.x
    I need to define new Initialization Block and in Administration Tool I am navigating Manage--> Variable and under Session I am creating new Initialization Block ..
    I am not sure which connection pool do I need to use to define new Initialization Block ?? I have checked exisiting Initialization Block and they have been using " Oracle Data Warehouse Repository Initblocks Connection Pool"...
    Reviewing SQL query log in Answers is using "Oracle Data Warehouse Connection Pool "...
    Can anyone suggest where do I need to write my Initialization Block ??
    Many Thanks,
    Sat

    Hello All,
    I have installed OBIEE11g (11.1.1.5.) and configured OBIA 7.9.6.3.. I am using Oracle Data Warehouse(Database Source) and warehouse tables exists under this node. Out of the Box OBIA has two connection pool
    1. Oracle Data Warehouse Connection Pool
    2. Oracle Data Warehouse Repository Initblocks Connection Pool
    I have standalone OBIA / OBIEE install and data is source from Oracle Ebusiness suite 12.1.3 and Siebel 8.1.x
    I need to define new Initialization Block and in Administration Tool I am navigating Manage--> Variable and under Session I am creating new Initialization Block ..
    I am not sure which connection pool do I need to use to define new Initialization Block ?? I have checked exisiting Initialization Block and they have been using " Oracle Data Warehouse Repository Initblocks Connection Pool"...
    Reviewing SQL query log in Answers is using "Oracle Data Warehouse Connection Pool "...
    Can anyone suggest where do I need to write my Initialization Block ??
    Many Thanks,
    Sat

  • Problem with a initialization block for a repository variable

    This is a very strange problem, some queryies which are issued on behalf of a Repository Variable give a succesfull completion but with 0 rows selected where it should select 1 row.
    I have a query like this
    select var1, var2, var3, var4 from table1
    where var1 = (select max(var1) from table2);
    When i test the query it gives nicely a result 1 row and the repository variables are filled correctly. The initialization block has a schedule so it will run once an hour.
    In the logfile I can see that the query is fired on behalf of my repository variable with a result of 0 rows.
    I thougt i could work around the problem by puttting the query in a view, import this view in my physical layer and do a simpel select var1, var2, var3, var4 from view in the initialization block.
    This still had the same result, testing it works fine I get nicely one record, when it is fired as a result of a schedule it gets a result of 0 rows selected.
    I've tried the query in different formats, the query that i started with was this (see below). When that didn't work i started testing with simplere query's like above
    select var1, var2, var3 , var4 from (
         select var1
         from table2
         where type='x'
    and datum = (select max(var1) from table2 where type='x')
    ) join table2 using (var1)
    Other init blocks work fine. Those init block differ from the one with the problem, they have no join between two tables. The only join I have in one of the working blocks is a join with something from dual.
    The other point is, this init block did work on a previous version of obiee, but after an upgrade it doesn't work anymore.
    The OBIEE version is 10.1.3.4.1.090414.1900
    The database is version 10.2.0.1.0
    I was able to test it myself on a 10.2 database with a 10.1.3.4.0 obiee there it worked fine. Also with 10.1.3.4.1 with a 11g database and that worked ok to.
    Has anybody else stumbeled on this problem and how can i solve it. Also workarounds are welcome. Preferably not changing to a session variable cause in that case i have to change all the reports that use this variable.
    Kind regards,
    Yvon

    Have your DBA put a trace on your OBIEE sessions to see what SQL is OBIEE firing and to confirm the rows do exist. Are you sure this data is always there?

  • Override the GROUP system session variable within an initialization block

    Hi,
    We're trying to override the GROUP system session variable and having no luck. We've created an initialization block to return the semicolon-separated list we're looking for but when a user logs in, it seems like it is overridden with the default. When we change the name of the variable to something other than GROUP, it works great and we get the expected value. Is there something we're missing with overriding the particular value?
    Here is the query we're attempting to use for the variable:
    Select 'GROUP',
       ListAgg(OBI_ROLE, ';') Within Group (Order By USER_EMAIL)
    From CSS_OBI_USER_ROLE
    Where USER_EMAIL In (':USER')
    We also tried:
    Select
       ListAgg(OBI_ROLE, ';') Within Group (Order By USER_EMAIL)
    From CSS_OBI_USER_ROLE
    Where USER_EMAIL In (':USER')
    We made sure that the variable name was 'GROUP' as well.
    Not sure if it's important to note or not, but the returned values do correspond to existing applications groups already defined within OBI.
    Any help is greatly appreciated!
    Thanks,
    Jas

    since you have value as OpsReviewViewer;OpsReviewAuthor:BIAdministrator
    my not help row wise setting
    try to handle ; part using sql query so that you get those number of records to use row-wise
    so this
    Select 'GROUP',
       ListAgg(OBI_ROLE, ';') Within Group (Order By USER_EMAIL)
    From CSS_OBI_USER_ROLE
    Where USER_EMAIL In (':USER')
    with row-wise show work

  • OBIEE 11g  Initialization Block problem with WLS User

    Hello,
    a brief description of my environment:
    - I have one machine with all OBIEE 11.1.1.6.2 components (build 120604.0813 BP1 64bit) and Oracle Database 11gR2;
    - In a separate machine I have the OID - Oracle Internet Directory where I have all business users with access to OBI Presentation Services;
    - In Weblogic Console I created a user named "weblogic" and this one is the administrator of all BI environment, this user is member of BIAdministrator and Administrators group, also this user is used to perform the communication between Fusion Middleware and Weblogic;
    - In weblogic Console I created a second user named "init_test" and he have the BIAuthor Role like the users that come from OID;
    - I have no problem logging in with all users OID and weblogic.
    Problem:
    - I created a simple Initalization Block and a variable to contain the result of the follow sql: SELECT region FROM adm_test_region WHERE city='Lisboa'
    - Initialization Blocks for Session variables are not working for "weblogic" user. For all other users everything is working as expected (users from OID and "init_test").
    Question:
    - There is any restriction in terms of Initialization Blocks for Session variables regarding the user that is linking Oracle Fusion Middleware with Oracle Weblogic?
    Thank you in advance,

    950780 wrote:
    Hello,
    a brief description of my environment:
    - I have one machine with all OBIEE 11.1.1.6.2 components (build 120604.0813 BP1 64bit) and Oracle Database 11gR2;
    - In a separate machine I have the OID - Oracle Internet Directory where I have all business users with access to OBI Presentation Services;
    - In Weblogic Console I created a user named "weblogic" and this one is the administrator of all BI environment, this user is member of BIAdministrator and Administrators group, also this user is used to perform the communication between Fusion Middleware and Weblogic;
    - In weblogic Console I created a second user named "init_test" and he have the BIAuthor Role like the users that come from OID;
    - I have no problem logging in with all users OID and weblogic.
    Problem:
    - I created a simple Initalization Block and a variable to contain the result of the follow sql: SELECT region FROM adm_test_region WHERE city='Lisboa'
    - Initialization Blocks for Session variables are not working for "weblogic" user. For all other users everything is working as expected (users from OID and "init_test").
    Question:
    - There is any restriction in terms of Initialization Blocks for Session variables regarding the user that is linking Oracle Fusion Middleware with Oracle Weblogic?
    Thank you in advance,When you say they are not working:
    1) You are using the session variables in a data filter in the RPD and for weblogic, the filter does not get applied?
    2) When trying to display the value of the sessoin variable in an analysis query, it errors out saying no value?
    As a BI Administrator, no data filters gets applied to the reports from the RPD unless you explicitly add them in the front end to the reports.
    You can also open the RPD in online mode, and go to sessions and kill everything, login using weblogic and monitor the sessions to see if a session is being created and the list of variables getting intilialized upon weblogic's entry into analytics.
    Thanks,
    -Amith.

  • RPD: How to use multiple-value variables in initialization blocks ?

    Hi all,
    I have a set of initialization blocks required for authentication, two of which are running row-wise. The first one sets a multi-valued variable, and the second one uses this variable.
    Or at least, should use, because it actually fails. The NQServer log says
    [nQSError: 13011] Query for Initialization Block 'My_Init_Block_2' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.MY_VAR_1, has no value definition.
    My first variable is initialized in a basic row-wise initialization block. What's more, if I say my 2nd block isn't required for authentication, and I read in a narrative the contents of my first variable, it contains the set of value I expect it to have.
    can anybody please advise?
    thanks in advance!
    Cedric..

    There is an example in the OBIEE Server Administration manual that looks very similar to your code except that the whole of the valueof string is quoted:
    select
    NAME, VALUE from RW_SESSION_VARS
    where USERID='VALUEOF(NQ_SESSION.USERID)' {code}<br /><br /><br /><br />Pete                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use session variables in initialization blocks

    Hello,
    I want to use a session variable in a initialization block. Here is what I was doing to see this working
    I created a init block called name_parameter and associated with a variable target named name_parameter_v. The init string for this block is "select 'Hello' from dual".
    i created another init block name_parameter2 and associated with a variable target named name_parameter2_v. The init string is "select :name_parameter_v from dual".
    I have selected name_parameter in the edit execution precedence for name_parameter2.
    The result set is empty. Could you please explain why I am not able to see Hello when i test name_parameter2.
    Thanks.

    to obtain the value contained in a session variable this is the syntax.
    select 'VALUEOF(NQ_SESSION.VARIABLE_NAME)' from dual
    mind the single quotes, they are necessary

  • Row wise initialized variable in WHERE clause of other initialization block

    Hi,
    i've following problem.
    I've created a initialization block (called A) that initializes a row wise session variable.
    Ex: SELECT X,Y from Z
    Select statement returns 3 rows (it's a row wise initialization block!!!)
    Then i want to create another initialization block that uses in its WHERE cluase the previous row wise variable
    Ex: SELECT W,T from R where F = VALUEOF(NQ_SESSION.A)
    I have following error: DB2-UDB: SQL10104 Token ; was not valid, valid tokens: ....
    I believe that this error is caused by the fact that VALUEOF(NQ_SESSION.A) is translated by OBIEE in IN (a list of values separated by ; and not by ,).
    Can you suggest me a solution?
    Thanks
    Giancarlo
    P.S. I'm using OBIEE 10G

    You could avoid this by rewriting it as
    select w, t
    from r
    where f in (select y from z where x = 'A')
    Regards,
    Robert

  • Row-Wise Session Variable Initialization Block (Max Rows)

    Hi, we have a problem with Row-Wise Session Variable.
    We'll try to implemented the security with a External Query and a Row-Wise Initialization Block. But when we'll try to open the Web Obiee and the rows of result of the query is more than 3000 rows, the browser is broken. The access is very slowly.
    When the result of Query to Row-Wise Variable is more than 3000 rows and we'll try to open the Web Obiee, we have to close NQServer.EXE process of Obiee Server.
    Is there a best practise or a limit rows in the Row-Wise Initialization Block?.
    Thanks.

    You're Right, the people can't be in 3000 groups.
    Is possible I don't explain my problem correctly.
    We use this Row-Wise Variable for implement Data Level Security. .
    For Example :
    I have a fact table with Offices and Office's Sales.
    And each Obiee User can see many Offices according to their level of security.
    I want filter the fact table using a external SQL table implemented in a Session Row-Wise Variable and a User can have X Offices (In the worst case, 3000 Offices).

  • Error in repository variables use in initialization blocks on Solaris 64

    Hello,
    I noticed a strange problem on OBIEE 10.1.3.4.1 installed on Solaris 64: it seems that it cannot convert the string 'VALUEOF(+repository variable+)' into the actual value of the parameter.
    For example, this is an initialization block to populate current fiscal project date variables (from NQQuery.log):
    +++Administrator:fffe0000:fffe0c3e:----2010/04/12 12:29:29
    -------------------- An initialization block named 'Current Project Variables', on behalf of a Session Variable, issued the following SQL query:
    select C.MCAL_PERIOD_NAME as MCAL_PERIOD_NAME
    ,C.MCAL_PERIOD as MCAL_PERIOD
    ,C.MCAL_PER_NAME_QTR as MCAL_QTR_NAME
    ,C.MCAL_PER_NAME_YEAR as MCAL_YEAR_NAME
    ,PAGO.MCAL_PERIOD_NAME as MCAL_PERIOD_AGO
    ,QAGO.MCAL_PER_NAME_QTR as MCAL_QTR_AGO
    from
    VALUEOF(OLAPTBO).W_MCAL_PERIOD_D C
    ,VALUEOF(OLAPTBO).W_MCAL_PERIOD_D PAGO
    ,VALUEOF(OLAPTBO).W_MCAL_QTR_D QAGO
    where C.adjustment_period_flg = 'N'
    and C.W_CURRENT_MCAL_PERIOD_CODE = 'Current'
    and C.MCAL_CAL_WID=valueof(NQ_SESSION.MCAL_CAL_WID_PROJ)
    and C.mcal_period_ago_wid= pago.row_wid
    and C.mcal_qtr_ago_wid=qago.row_wid
    and c.mcal_cal_wid= pago.mcal_cal_wid
    and c.mcal_cal_wid=qago.mcal_cal_wid
    Returned 0 rows. Query status: Failure
    As you can see, VALUEOF(OLAPTBO) should be substituted by the repository session variable, but instead it seems that the BI Server simply issues to the database the initialization block statement as-is!
    Any idea?
    Thanks in advance for the help,
    Vincenzo Maggio

    As a test, I tried to add the filter to the individual user first. In the Repository I went under Manage-Identity. Clicked on my User and hit permissions button.
    I created the filter of:
    "Testing and Assessments"."Student SOL Testing"."Teacher Employee Number" = VALUEOF(NQ_SESSION."VAR_EMPLOYEE_NUMBER")
    That didn't work. I still see all data when I log in as that user. If I hard-code it to the users Employee Number (see below), it does work. What now?
    "Testing and Assessments"."Student SOL Testing"."Teacher Employee Number" = '19983758'

  • Instance initializer and static initializer blocks

    Hi guys,
    I read about the above mentioned in the JLS and also in a book before, but I still don't quite understand, what is the use of these. I sort of have a rough idea, but not exactly. I mean, what is the purpose of the instance initializer and static initializer blocks, how can it be useful? I understand I can execute pieces of code that will initialize instance and static variables accordingly, but how is it different then to using a constructor to initialize these fields? Are these pieces of code executed before any constructor is executed, or when otherwise?
    Sorry for my noob, I'm learning.
    PR.

    Static initializers are useful for initializing a class when the initialization is more complex than simply setting a single variable, or when that initialization can throw a checked exception.
    public class Foo {
      private static final Bar bar;
      static {
        try {
          bar = new Bar();
          bar.doSomeInitializationStuff();
        catch (SomeCheckedExceptionThatBarThrows e) {
          throw new ExceptionInInitializerError(e);
    }Here we could not do the two-step new Bar() + doSomeInit() stuff in the line where we declare the bar variable. Additionally, assuming that one or both of those can throw a checked exception, we could not do that on the declaration line; we need the static initializer to wrap that in the appropriate unchecked exception.
    This allows us to do more complex class initialization when the class is loaded than we could do with a simple variable initialization.
    Instance initializers are useful if you want to perform the same steps in every constructor and don't want to have to repeat the code in each constructor. Instance initializers are executed as the first step of each constructor (or maybe it's after any super() calls, I forget).

  • Dynamic variable in 11g rpd - character 'd' got appended to default value

    Hi All,
    We have recently upgraded to 11.1.1.6 version from obiee10g.
    We are facing an issue with default initializer in the dynamic variables in the RPD.
    For one of the dynamic variables XYZ_YEAR default value is '2013.0d' in 11g. In 10g for the same dynamic variable XYZ_YEAR default value is '2013'.
    As we are using this variable on the 11g dashboard the following error has been thrown -- A numeric value was expected (received "2013.0d")
    After the upgrade we are unable to do online changes to the RPD. That is another issue.
    So, coming back to the variable issue. I have taken a offline copy of the rpd and changed the default value of the variable to '2013.0'.
    And ported the offline rpd via EM. Initially, it seemed to be resolved. But, after sometime the dashboard got errored out with the same error.
    I went back to check the online rpd and saw the dynamic variable's default value as '2013.0d'
    I have tried making changes in offline rpd twice and ported the rpd via EM but the issue still persists.
    Thanks,
    Obul
    Edited by: obul on Nov 23, 2012 3:44 AM

    An easiy solution to this issue is to change the SQL for the initialization block to look like this:
    select cast(year as number (4,0)) from blah....
    The ,0 in the number specifier truncates any decimal data, and OBIEE then sees it as an integer type instead of decimal. Sorry, I posted this answer in another thread, but there seem to be quite a few threads about this issue.
    Hope it helps!
    Scott

Maybe you are looking for