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
Similar Messages
-
Use row wise session variable in IN CLAUSE
Hi,
I' have a question. Suppose I have a row wise session variable named Users setted in an initialization block with following SQL query:
SELECT 'NAMES', names from NAMES_TABLE where GROUP='Administrators'
Suppose it returns value list 'JOHN, MARIE'.
Can I set another row wise session variable named COUNTRY in initialization block with following SQL query:
SELECT 'COUNTRY', country from COUNTRY_TABLE where names IN (VALUEOF(NQ_SESSION.Users))?
so that COUNTRY variable returns for example list 'CANADA','OHIO'?
or OBIEE returns error?
If it's not possible can you give me a solution?
ThanksHi,
I've resolved, but now I have another problem.
I have a row-wise session variable called COMPANY_FILTER
In Dashboard Prompt "Show" Section I have following query:
SELECT Country."Company Description" from Prototype where Country."ID" = VALUEOF(NQ_SESSION.COMPANY_FILTER).
When COMPANY_FILTER has at least one value it works fine. But COMPANY_FILTER can be even empty.
In the latter case query fails.
Now, when COMPANY_FILTER is null I must execute following query:
SELECT Country."Company Description" from Prototype
otherwise when it is filled i must execute following query:
SELECT Country."Company Description" from Prototype where Country."ID" = VALUEOF(NQ_SESSION.COMPANY_FILTER).
I have tried with CASE WHEN, but i don't know the exact syntax. Can you suggest me a correct query for my goals?
Thanks -
Variable in where clause of the logical table
Hi,
is it possible to define a variable in "where" clause of rpd's physical table (table type - select)? If yes, pls elaborate the steps including how to refresh it with every end user's request?
Thanks and Regards,
Igor
P.S.
If not, is there any workaround?Nico
thanks, but I am afraid that is not my case. I need to refresh variable value interactively with every query by a dashboard prompt. To illustrate my need just imagine a recursive SQL (defined as a view/logical table in rpd):
SELECT ....
FROM ...
WHERE ...
START WITH .... columnA=variable1
CONNECT BY PRIOR .... and columnB=varariable2;
or
SELECT c1,c2,c3,c4 from tabA where c1='A' and c2=variable1
union
SELECT c1,c2,c3,c4 from tabA where c1='A" and c2='D' and c1 NOT IN ( SELECT c1 FROM tabA where c1='A' and c2=variable1 );
So, what I want to do is to pass value(s) to my variable(s) every time when respective select (view) is executed. I see above selects are not typical ones the OBI EE is intended for but nevertheless I wonder if such kind of reports are possible to do in OBI EE.
Thanks and Regards,
Igor -
Boolean variable in where clause
Hello,
Does anyone know if it possible to include
BOOLEAN variable in where clause as following:
is_in_group BOOLEAN;
begin
is_in_group :=
portal30.wwsec_api.is_user_in_group (
p_person_id => portal30.wwctx_api.get_user_id,
p_group_id => portal30.wwsec_api.group_id('GROUPNAME')
for x in(select start_time,title
from ec_reservations
where
start_time >= '2004-JAN-01'
and rv_target_type='PU'
and is_in_group = true
Thank You,
HelenaWell, let's try it, eh?
SQL> conn scott/tiger
Connected.
SQL> CREATE OR REPLACE FUNCTION sal_test ( p_sal IN NUMBER) RETURN BOOLEAN IS
2 BEGIN
3 RETURN p_sal > 1500;
4 END;
5 /
Function created.
SQL> SELECT ename, sal
2 FROM emp
3 WHERE sal_test(sal) = TRUE;
WHERE sal_test(sal) = TRUE
ERROR at line 3:
ORA-00904: "TRUE": invalid identifier
SQL> So this is what we find. BOOLEAN is not a vlid SQL datatype, at least for Oracle. This is a source of much wailing and gnashing ot teeth. I believe there are enhancement requests for it, but no signs on the horizon.
In the example you give you need it. You would be better off doing this...
is_in_group BOOLEAN;
begin
is_in_group :=
portal30.wwsec_api.is_user_in_group (
p_person_id => portal30.wwctx_api.get_user_id,
p_group_id => portal30.wwsec_api.group_id('GROUPNAME')
IF is_in_group = true THEN
FOR x IN (select start_time,title
from ec_reservations
where start_time >= '2004-JAN-01'
and rv_target_type='PU' )
...Otherwise you have to recast your function so it returns VARCHAR2 with values of 'TRUE' and 'FALSE' (or NUMBER returning 0 and 1, whatever).
Cheers, APC -
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). -
Multiple Row-wise session Variable in One Init Block
Hi All,
Can we create Multiple Row-wise session Variable in the same Init Block ?
I need 10 session varibales with row-wise initialization in the same block otherwise i will have to create 10 initialization block .
Any help is appreciated.
Thanks,
AllyHi Ally,
I'm not sure if this will work but have you tried a UNION ALL statement?
ie.
SELECT 'GROUP, group_id
FROM groups
UNION ALL
SELECT 'DEPT',dept_id
FROM depts
etc.... -
Prompt using SQL Results with row-wise session variable comparison
I have a prompt on Department and I only want the departments to show that have been authorized via a session variable for that user. The session variable can return can return multiple values and is set as row-wise. The session variable is returning results and have been used successfully in an application filter.
I'm trying to put the correct SQL statement and this syntax doesn't work:
SELECT "Department"."Department Code"
FROM "UBC Financials - YTD Table"
WHERE "Department"."Department Code" = '@{DEPT_LIMITS}'
Can someone give me an example that does work?
Thanks,Try something like WHERE "Department"."Department Code" = VALUEOF(NQ_SESSION."DEPT_LIMITS")
or else filter on department and then hit on add then Session variable
~ http://cool-bi.com -
How can we use form variable in where clause while personalization
Dear,
I have a requirment for using select in personalization, actully we have created temporary table, now we want to get data from select satatement on event"when-new-record-instance' trigger, now in action tab i have selected action which is property and message, in message column showing value "${item.q_res.transaction_id.value}" it shows on validate button but when this form variable use in action type(property) which is consist on select statement "=SELECT to_char(QTY) FROM TEST_TABLE where transaction_id = ${item.q_res.transaction_id.value}" system didn't get value pressing validate button although there is a single record in customize table while without where cluase was getting data perfectly.
please advice.>
I am looking for to decode the actual db value something in different for my report.
like if A then Accepted
elseif R then Rejected
elseif D then Denied
these conditions I have to check in where clause.
>
what are you trying to do?
may be you are looking for
select * from tab1,tab2
where a.tab1 = b.tab2
and
(decode(:code, 'A','Accepted') = <table_column>
or
decode(:code, 'R','Rejected') = <table_column>
or
decode(:code, 'D','Denied') = <table_column>
) -
hello,
we want to build an dynamic sql IR. so when a user logs into our application we have an page process that fills an application item :F_ITEM_WHERE with part of the where clause from an IR. On the page with the IR we have as region source something similiar to:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
AND test_vtr.id_per_cus IN
*(SELECT id_per_cus*
FROM viva_per_cus
WHERE LEVEL BETWEEN test_api_per_emo_r_tree.get_per_emp_r_tree_from(:F_ID_PER_EMP,
*:F_ID_GRP) AND*
test_api_per_emp_r_tree.get_per_mit_r_tree_to(:F_ID_PER_EMP,
*:F_ID_GRP)*
START WITH per_cus_nr =
test_api_per_emp_r_tree.get_per_emp_r_tree_tree(:F_ID_PER_EMP,
*:F_ID_GRP)*
CONNECT BY PRIOR per_cus_nr = per_cus_number
AND PRIOR id_grp = :F_ID_GRP)
AND EXISTS
so we want outsourcing the marked part of the where clause into :F_ITEM_WHERE. The result is as following:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
AND test_vtr.id_per_cus IN *|| :F_ITEM_WHERE ||*
AND EXISTS
Here says Apex that the Query cannot be parsed...if we fill the item plus 'AND test_vtr.id_per_cus IN' so our statement looks like this:
SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
vtr_nr AS "VS-Nr."
id_vtr,
id_per_cus
FROM test_vtr
WHERE test_vtr.id_grp = :F_ID_GRP
*:F_ITEM_WHERE*
AND EXISTS
the query can parse but after that running apex says: bind :F_ITEM_WHERE not possible
Anyone got an solution for this? I think it´s only a syntax thing or something...
Thanks Daniel
Edited by: user12086353 on 14.09.2010 06:01When posting code on the forum, put {noformat}{noformat} (with the curly brackets and the word code in lowercase) above and below your code like this...
{noformat}{noformat}
SELECT *
FROM emp
{noformat}{noformat}
It will then appear like this, preserving formatting...SELECT *
FROM emp
Please post your code, properly formatted of +exactly+ what you have put in the region source. I'm not convinced that you need dynamic SQL at all.
Cheers
Ben -
Using a report value for a where clause in other report
Hi All,
i'm getting kinda nuts here. I created a page with three reports.
First report show the name of the user who logged in with his/her whole name. Second report shows the year, week, begin/end date of the week for the user in the first report. The third report show the hours the user worked in the week selected in the second report.
The link between first and second report is on column report. Somehow i managed it to work with second_report.mdw_code = :P3_ACRONIEM. I have no idea were this P3_ACRONIEM item is coming from, while i have no items in my page whatsoever. Now i need to link the second report to the third report. I have to use the second_report.mdw_code, second_report.year and second_report.week but i have no idea how to link these together. Any idea's? (Like making items, but then i have no idea how to link that item to the value in the second report). Please help.
Kind regards,
Dave
The link between the first and the second i could get it to work with :P3_ACRONIEM. I have no idea where this ITEM is coming from, because i have no items in my page (and it's the only page in the application). ThenHi Dave,
If I understand you correctly, you have a one report that lists users, a second report that lists dates and a final report that shows hours worked?
If so, you may find it easiest to have hidden fields on your page and base the second and third reports on these using appropriate WHERE clauses. (I generally put hidden fields in a region in the "After Header" position)
So, if the first report contains a USER_ID field, have a hidden field called P1_USER_ID. The link on the first report will branch back to the same page and set the value of P1_USER_ID to #USER_ID# The second report can then use WHERE USER_ID = :P1_USER_ID. When the page reloads, the second report redisplays and is filtered to show only those records relating to the selected USER_ID in the first report.
To extend this, if the second report contains WEEK_NUMBER, it should have a link that branches back to the same page and sets a hidden P1_WEEK_NUMBER field with #WEEK_NUMBER#. The third report should when have WHERE WEEK_NUMBER = :P1_WEEK_NUMBER AND USER_ID = :P1_USER_ID. You can, if need be, have and set more than one hidden field during each link.
Regards
Andy -
Please help. Thank you for your time and expertise.
Prerequisites: sql query needs to be a view. Real view is more than recursion. It computes location path, is used in JOINs and returns this path.
Problem: no matter what I tried, sql server does not produce 'index seek' when using variable but does with literal.
See full reproduction code below.
I expect that query SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID will seek UNIQUE index but it does not.
I tried these:
1. Changing UX and/or PK to be CLUSTERED.
2. query OPTION(RECOMPILE)
3. FORCESEEK on view
4. SQL Server 2012/2014
5. Wrap it into function and CROSS APPLY. On large outer number of rows this just dies, no solution
but to no avail. This smells like a bug in SQL Server. I am seeking your confirmation.
I am thinking it is a bug as variable value is high-cardinality, 1, and query is against unique key. This must produce single seek, depending if clustered or nonclustred index is unique
Thanks
Vladimir
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir MoldovanenkoHere is more... note that I am creating table Items and these can be in Locations.
I am trying LEFT JOIN and OUTER APLLY to 'bend' query into NESTED LOOP and SEEK. There has to be nested loop, 2 rows against 4. But SQL Server fails to generate optimal plan with SEEK. Even RECOMPILE does not help
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
--DECLARE @Count int = 10;
--WITH L0 AS (SELECT N FROM (VALUES(1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) N (N))-- 10 rows
--,L1 AS (SELECT n1.N FROM L0 n1 CROSS JOIN L0 n2) -- 100 rows
--,L2 AS (SELECT n1.N FROM L1 n1 CROSS JOIN L1 n2) -- 10,000 rows
--,L3 AS (SELECT n1.N FROM L2 n1 CROSS JOIN L2 n2) -- 100,000,000 rows
--,x AS
-- SELECT TOP (ISNULL(@Count, 0))
-- ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) as Number
-- FROM L3 n1
--SELECT Number as itmID, NTILE(4)OVER(ORDER BY Number) as lcID
--INTO dbo.Items
--FROM x
----ORDER BY n1.N
--ALTER TABLE dbo.Items ALTER COLUMN itmID INT NOT NULL
--ALTER TABLE dbo.Items ADD CONSTRAINT PK PRIMARY KEY CLUSTERED (itmID)
CREATE TABLE dbo.Items (itmID int NOT NULL PRIMARY KEY, lcID int NOT NULL)
INSERT INTO dbo.items
VALUES(1, 1)
,(2, 3)
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
--SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID-- OPTION(RECOMPILE) -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
SELECT *
FROM dbo.Items itm
LEFT JOIN dbo.vwLocationCodes l ON l.lcID = itm.lcID
OPTION(RECOMPILE)
SELECT *
FROM dbo.Items itm
OUTER APPLY
SELECT *
FROM dbo.vwLocationCodes l
WHERE l.lcID = itm.lcID
) l
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
--SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir Moldovanenko -
View Variable for WHERE clause "ORA-06550, INTO clause expected"
Hi Guys,
two questions
1. can a view have variables like:
create view myview
As
myname varchar(5) = bob
select * from mytable where name = myname
2. if so, why does a simple select above cause
the error "ORA-06550, INTO clause expected" ?Hi,
no so direct is not possible. There are workarounds, see this thread on Asktom: [url http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1448404423206]Parameterized view
Herald ten Dam
http://htendam.wordpress.com -
VO - bind variable in where clause problem
Hi
I have Jdeveloper 12. I successfully connected to mySQL database which works in Oracle mode (PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER)
Next I created EO, VO (screenshot) and finally AM.
when I run Application Module and enter bind variable value I receive error (screenshot):
oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT EO_TMP.create_date, EO_TMP.id, EO_TMP.name FROM autoid.advert EO_TMP WHERE EO_TMP.id = :var1
## Detail 0 ##
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
Doesn anybody know hot to fix this issue?
Regards.I decided to check if it is a mySQL driver so I've performed the same query using a below code and it works. This is definitely model configuration issue.
Connection con = null;
try{
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost/sakila?user=root&password=1qaz2wsx");
String selectSQL = "SELECT actor_id,first_name,last_name,last_update FROM actor WHERE actor_id = ?";
PreparedStatement preparedStatement = con.prepareStatement(selectSQL);
preparedStatement.setInt(1, 4);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String userid = rs.getString("ACTOR_ID");
String username = rs.getString("FIRST_NAME");
System.out.println(userid);
System.out.println(username);
}catch (Exception e){
System.out.println(e.toString()); -
How to use sql "IN" operator with named bind variable in where clause ?
Can one bind variable be used for the "IN" list ('1','2','3') ?
rob,
No worries. Glad it helped. Glad to see also that you're doing things right and trying to use bind variables ;)
May I suggest adding "SOLVED" to the title of the original post?
Best,
John -
OBIEE 11.1.1.6.2 Row Wise Init for Roles variable
Gurus,
Why is the NQ_SESSION.ROLES ( Row Wise Initialized ) behaving differently when compared to other Row Wise initialized session variables.
I am using EBS Authentication and Authorization for OBIEE, so my authorization query is
SELECT DISTINCT 'ROLES', RESPONSIBILITY_KEY
FROM FND_USER,FND_USER_RESP_GROUPS, FND_RESPONSIBILITY_VL
WHERE FND_USER.user_id=FND_USER_RESP_GROUPS.user_id
AND FND_USER_RESP_GROUPS.RESPONSIBILITY_ID = FND_RESPONSIBILITY_VL.RESPONSIBILITY_ID
AND FND_USER_RESP_GROUPS.RESPONSIBILITY_APPLICATION_ID = FND_RESPONSIBILITY_VL.APPLICATION_ID
AND FND_USER_RESP_GROUPS.START_DATE < SYSDATE
AND (CASE WHEN FND_USER_RESP_GROUPS.END_DATE IS NULL THEN SYSDATE ELSE TO_DATE(FND_USER_RESP_GROUPS.end_Date) END) >= SYSDATE
AND FND_USER.user_name = 'VALUEOF(NQ_SESSION.USER)';
Now I plan to use these Roles( EBS Responsibility name) which I have populated in a DB table against some Cost Center and below is the how I view the data in DB.
ID | PROFIT_CENTER | RESPONSIBILITY
0 | 0 |0
1 | 100 |BI_Fin_Role
2 | 200 |BI_P2P_Role
3 | 300 |BI_Inv_Role
Then my Profit Centers Initialization Block is now
SELECT DISTINCT 'PROFIT_CENTER', PROFIT_CENTER FROM WC_OBIEE_PC_SECURITY WHERE RESPONSIBILITY IN (VALUELISTOF(NQ_SESSION.ROLES))
So User1 has BI_Fin_Role and PC_Security Role so does the User2 has BI_Inv_Role and PC_Security now when User1 logs in they should see only 100 Profit center data and User2 should see only 300.
I have created data filter for that application role (PC_Security) and limiting with "Dim.Profit Center"."Profit Center" = VALUEOF(NQ_SESSION."PROFIT_CENTER")
However first problem I encounter is there is no value definition for PROFIT_CENTER, snap that means the VALUELISTOF(NQ_SESSION.ROLES) value is not being passed or recognized by whenever BI Server sends that query to DB.
This is confirmed by my query log which says:
[2013-04-29T12:49:06.000+00:00] [OracleBIServerComponent] [TRACE:5] [USER-39] [] [ecid: 11d1def534ea1be0:48033065:13e4213bbd0:-8000-0000000000008dc8] [tid: 47796940] [requestid: fffe0313] [sessionid: fffe0000] [username: ] -------------------- An initialization block named 'PC_Security', on behalf of a Session Variable, issued the following SQL query: [[
SELECT DISTINCT 'PROFIT_CENTER', PROFIT_CENTER FROM WC_OBIEE_PC_SECURITY WHERE RESPONSIBILITY IN (VALUELISTOF(NQ_SESSION.ROLES))
Returned 0 rows. Query status: Successful Completion
So I try to issue the SQL to BI Server thru Issue SQL Directly:
SELECT "Profit Center"."Profit Center" FROM "SLA Details" WHERE "Profit Center"."Profit Center" = VALUEOF(NQ_SESSION.ROLES)
and the query log gives be the below log which blew my mind as its being delimited by ';'
select distinct T1260626.ACCOUNT_SEG3_CODE as c1
from
W_GL_ACCOUNT_D T1260626 /* Dim_W_GL_ACCOUNT_D */
where ( T1260626.ACCOUNT_SEG3_CODE = 'BIAuthor;BIConsumer;PC_Security;BI_Fin_Role;AuthenticatedUser' )
I have other Row Wise Init blocks for HR_ORG which when fired and used in reports give be stings ('1000','2000',...) which is what I was expecting to see in the filter and query here.
Am I doing something wrong here can someone please point me to right direction please.
Any help is much appreciated.
Thanks,
VidyaS
Edited by: VidyaS on Apr 29, 2013 2:47 PMThis is because the ROLES variable in OBIEE 11g is designed to retrieve the LDAP or DB groups etc.. in form of semicolon delimiters this would be not the same case with other Row Wise init blocks.
Refer to : OBI 11g - LDAP and semicolon-delimited string for Groups [ID 1274964.1]
HTH,
SVS
Maybe you are looking for
-
Sales order for service should create project and link equipments.
Hi, I'm trying to create a sales order for a service material through VA01. The problem is that this sales order should create a proyect, but at the same time i should be able to associate several equipments to the item position. The problem is that
-
I have added 2 new email accounts to my Imac. How do I get them to appear on my macbook pro and my iPhone. The computers are with maverick and the iPhone has the latest iOS 7.0.3. Thanks
-
Reversal of a budget document can't be undone
I have a posted budget document from several months ago that someone tried to reverse recently by preposting a reversal and then decided to reject the reversal. The workflow tried to undo the preposted reversal but got the following error: "Original
-
Difference between doc date,posting date and invoice date
hi bw guys can someone give a brief on the difference between doc date,posting date and invoice date.and the invidual definitions thank you
-
How can I submit my research ideas to Apple?
Hello Community, can you please answer my question in the title? Do I have to use a specific e-mail address or other means of communication? I am pleased to answer many. Thank You! Greetings DaniN89