Use Session Variable with row-wise initialization
Hello,
I use an initialization block in order to load some translations in my repository (version is 11.1.1.6.BP1) :
SQL :
SELECT CODE_KEY, STRING_VALUE FROM "TABLES" WHERE LANGUAGE_KEY= 'VALUEOF(NQ_SESSION.USERLOCALE)'
Values :
CN_INCOMING, Incoming, en
CN_OUTGOING, Outgoing, en
CN_INCOMING, Réception, fr
CN_OUTGOING, Emission, fr
etc ...
I checked the row-wise intialization.
The query is correct and returns the right values (I check in the log file ..).
So far, So good.
But when I want to use session variables in a column expression (in repository) like :
CASE WHEN "column"="xx" THEN VALUEOF(NQ_SESSION."CN_INCOMING") ELSE VALUEOF(NQ_SESSION."CN_OUTGOING") END
I got the error: [nQSError: 23006] The session variable, NQ_SESSION.CN_OUTGOING, has no value definition.
If I used the same formula directly in Answers it's working correctly.
Do I have to necessarily do this in answers or is there a way to do this in the repository.
Thanks in advance
Regards
Benjamin
Yes I already tested this point, when I don't use a row wise initialization it's working, but I don't want to create one variable for each translations that I need to use in column formula if you know what I mean.
I don't understand why we can't use this kind of variable in this context ..but if I have to create the column in my analysis, I will do that, but it's not really user friendly
Anyway thanks for your time.
Similar Messages
-
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 -
Using Session Variable with Conditional Formatting Filter
Hi,
I'm trying to add a condition to my report in order to flag all opportunities that have a close date that is in the past. The way I'm trying to do this is by adding a condition to say when close date is less than current_date, flag the column with an image.
Issue I'm having is that the filter window within conditional format tab appears to not have the session variable option as you do when you create a filter on a column the normal way. A colleague told me to use an SQL expression, but again this option seems to be unavailable too within the conditional format tab.
Can anybody assist please?
ThanksCreate a new column and write a CASE WHEN condition like case when close date < current_date then 'Y' ELSE 'N' END.
Then on your actual date column, you can do conditional analysis based on the newly created column for values having Y then the image.
finally, you can hide the newly created column. -
Row wise Initialization - "Session Variable has no value Definition"
Hi,
I have gone through other posts relating to this error, but could not find a solution.
I have defined an initialization block with 'Data Source' as SELECT 'TEST_VARIABLE', cost_center from XX_COST_CENTER.
In the 'Edit Data Target', i have selected the 'Row Wise Initialization' option.
When i 'Test' this initialization block, using the 'Test' button, i get the exected output, with all the different Cost Centers being defined.
However, in the Presentation Services when i add a column and change its formula to VALUEOF(NQ_SESSION.TEST_VARIABLE), i get an error
+[nQSError: 23006] The session variable, NQ_SESSION.TEST_VARIABLE, has no value definition.+
Would appreciate some input, to check if i have missed any steps, or am doing something wrong
Thanks & Regards,
Ab
Edited by: obiee_user_ab on Jan 16, 2012 6:25 AMHi,
Error is caused because no value is returned from the sesision variable for the logged in user, you may check the NQquery.log file to see if the initblock was successfull and if that returned any rows, try setting default value in the session variable
It might also happen when
1. You created the variable as Repository variable in RPD and referring as session variable in Answers
2. It may also happen when you are referring the Session variable Name wrongly in Answers. E.g "Current Week" in RPD (2 Words) and CurrentWeek in Answers (Single word).
Try to use the same letter case for the name of the variable (upper and lower).
Hope this helps.
Regards
MuRam -
Row-wise Initialization: Use caching
We have the 'Use Caching' check box available for row-wise initialized system variables. Although I do understand how this is useful as it shortens the login time for users who have logged in before by initializing the session variable from the cache instead of firing the query on the database everytime, I need to understand how this cache mechanism works especially when the overall server caching is disabled.
I have faced a situation where the session variable was initialized from the cache although the server caching was disabled. Is there any way to purge this cache or set a refresh frequency? As of now I had to uncheck the 'Use Caching' check box to fetch the refreshed results in the session variable. But I believe this is undesirable in the long term.
Thanks,
GauravHad thought so. But then it means that you can use row-wise initialization with caching, only when the underlying data is never going to change. Restarting the BI server is not a viable option to clear the cache in systems which require 100% availability.
But any ways, thanks for the input Dhar.
Thanks,
Gaurav -
Using Session Variable in the Column Level Security
My Question -
1. I created an initialization block with initialization string by calling a new session variable CTP_ID_LIST in the sql command, given appropriate database connections and when I exit out of Block, and chosen Row-wise initialization. I do not see a new session variable created under variables list. Why does this happen? Please help me on this.Hi,
This happens when you select Row-wise Initialization.
The row-wise initialization feature allows you to create session variables dynamically and set their values when a session begins. The names and values of the session variables reside in an external database that you access through a connection pool. The variables receive their values from the initialization string that you type in the Initialization Block dialog box.
You can also use the row-wise initialization feature to initialize a variable with a list of values. You can then use the SQL IN operator to test for values in a specified list.
Example: Using the table values in the previous example, you would type the following SQL statement for the initialization string:
select 'LIST_OF_USERS', USERID
from RW_SESSION_VARS
where NAME='STATUS' and VALUE='FULL-TIME'
This SQL statement populates the variable LIST_OF_USERS with a list, separated by colons, of the values JOHN and JANE; for example, JOHN:JANE. You can then use this variable in a filter, as shown in the following WHERE clause:
where TABLE.USER_NAME = valueof(NQ_SESSION.LIST_OF_USERS)
The variable LIST_OF_USERS contains a list of values, that is, one or more values. This logical WHERE clause expands into a physical IN clause, as shown in the following statement:
where TABLE.USER_NAME in ('JOHN', 'JANE')
Regards
MuRam -
Handling Null Row wise initialization
Hi,
I am creating row wise initialization block to restrict the number of records returned by a Answers.
I am populating a session variable called, REPS_LIST. When I put the condition,
Fact.REP_ID = VALUEOF(NQ_SESSION."REPS_LIST") the group filter works fine.
I want to handle a situation where REPS_LIST is NULL.In that case,I would to get all the rows from my fact. For this, I put the filter like
Fact.REP_ID = IFNULL( VALUEOF(NQ_SESSION."REPS_LIST"), "Fact".REP_ID)
However when i run the Answers report, it says no value definition for REPS_LIST. How can I handle the null condition here?
Thanks,
Vivek.John,
It appears that the row-wise session variables can be used only with the equality(=) sign. We can't put them in any other function in that the server convert these variables into comma separated string and replaces the = by IN operator. So if I had following filter
Fact.REP_ID = VALUEOF(NQ_SESSION."REPS_LIST")
then it actually gets translated into something like
Fact.REP_ID IN (1001, 1002, 1003....)
As you suggested, I played with the SQL than going behind the above syntax and was able to achieve what I wanted.
Thanks,
Vivek. -
Regarding Logical level key and row wise initialization
Hi Gurus,
What is the purpose of row wise initialization in external table authentication and when we have to go for row wise initialization.
Why we have to enable logical level key in hierarchy is this only for getting drill down to the next level if we make two columns as logical level key what will happens. If we want to enable a column as a logical level key what are the character sticks that column should satisfy.
Thanks,1) Row Wise Initialization used to hold multiple values in a variable. Let says SQL gives 4 rows (A,B,C,D) as output. Now I want to hold 4 value in a variable to get this happen we need to go for RowwiseIniziation. If you do not do this at any point in time Variable holds only value A not others. Simply it works as Array.
2) Level keys define the unique elements in each level and provide the context for drill down. You can make two logical columns as logical key but you need to make sure what to be displayed in your hierarchy by selecting DISPLAY. If you make to as separate logical keys and set Display for both you get two columns in the hierarchy
http://gerardnico.com/wiki/dat/obiee/hierarchy_level_based -
Row wise Initialization - Huge LOV
We use External table for Authentication & uses row wise Initialization. It is working perfectly fine, but the issue is the list of values (output) from row wise initialization is pretty large (the output SQL will be at least 30 pages). This is alarming the management and mainly the DBA's and atleast once in a week we are experiencing issues with these SQL's. And in near future, the SQL will be extending drastically as the company has acquired another 2 companies and once the integration is completed, the LOV's from row wise initialization will easily go upto 90 to 100 pages. Let me explain you what I did... We have around 10 Init blocks used for Authentication, but I am mainly concerned about 2 (cf_visibility & sc_visibility) as these are used in Security/Group/Permissions/Report Filters. Each report will for sure have these filters attached. Here cf_visibility Init SQL is (SELECT DISTINCT 'cf_list', CHILD_COMPANY_ID FROM COMPANY_VISIBILITY CV, CLIENT_FACILITY CF WHERE CV.ANCESTOR_COMPANY_ID=(SELECT SUBSTR(':USER', 0, (INSTR(':USER', '.')) - 1) FROM DUAL) AND CV.CHILD_COMPANY_ID=CF.CLIENT_FACILITY_ID AND CV.DW_DELETE_DATE IS NULL UNION SELECT DISTINCT 'cf_list', 0 FROM DUAL) and
sc_visibility Init SQL is (SELECT DISTINCT 'sc_list', CHILD_COMPANY_ID FROM COMPANY_VISIBILITY CV,SERVICE_CENTER SC WHERE CV.ANCESTOR_COMPANY_ID= (SELECT SUBSTR(':USER', 0, (INSTR(':USER', '.')) - 1) FROM DUAL) AND CV.CHILD_COMPANY_ID=SC.SERVICE_CENTER_ID AND CV.DW_DELETE_DATE IS NULL
UNION SELECT DISTINCT 'sc_list', 0 FROM DUAL)
and both are row wise initialization blocks. The filter used for all the Groups is [(DEP.Jobs."Client Facility ID" = VALUEOF(NQ_SESSION."cf_list")) AND (DEP.Jobs."Service Center ID" = VALUEOF(NQ_SESSION."sc_list"))]. This output LOV for this filter is huge as I said earlier.
My main goal here is to reduce the size of the SQL to 1 page, I am planning to do that by replacing the LOV list by SQL (Kind of sub query). I started experimenting with only cf_visibility for now. I replaced the existing SQL with (select 'cf_list',
'SELECT DISTINCT CHILD_COMPANY_ID FROM COMPANY_VISIBILITY CV, CLIENT_FACILITY CF WHERE CV.ANCESTOR_COMPANY_ID=(SELECT SUBSTR('':USER'', 0, (INSTR('':USER'', ''.'')) - 1) FROM DUAL) AND CV.CHILD_COMPANY_ID=CF.CLIENT_FACILITY_ID AND CV.DW_DELETE_DATE IS NULL UNION SELECT DISTINCT 0 FROM DUAL'
from dual)
this returns only 1 row, with 1column as cf_list and the next column with the ('SELECT DISTINCT CHILD_COMPANY_ID FROM COMPANY_VISIBILITY CV, CLIENT_FACILITY CF WHERE CV.ANCESTOR_COMPANY_ID=(SELECT SUBSTR('':USER'', 0, (INSTR('':USER'', ''.'')) - 1) FROM DUAL) AND CV.CHILD_COMPANY_ID=CF.CLIENT_FACILITY_ID AND CV.DW_DELETE_DATE IS NULL UNION SELECT DISTINCT 0 FROM DUAL') Note: USER will be replaced with actual User Name.
But when I run a report in Answers, it throws me an error [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtExecute. I understand the error as it is clearly mentioned, but my question is "Is there any way not to get that huge list in the SQL"
Let me show you the SQL generated along with the error. As this is a Report filter I am only attaching the where clause of the Query. (where ( T38857.CLIENT_FACILITY_ID in ('SELECT DISTINCT ''cf_list'', CHILD_COMPANY_ID FROM COMPANY_VISIBILITY CV, CLIENT_FACILITY CF WHERE CV.ANCESTOR_COMPANY_ID=(SELECT SUBSTR(''5700.abcde'', 0, (INSTR(''5700.abcde'', ''.'')) - 1) FROM DUAL) AND CV.CHILD_COMPANY_ID=CF.CLIENT_FACILITY_ID AND CV.DW_DELETE_DATE IS NULL UNION SELECT DISTINCT ''cf_list'', 0 FROM DUAL') ).
So I also thought if I use REPLACE function and replace 'Single Quote' before and after the SQL statement with 'Space', it may work. So I edited one of the Group's report filter ((DEP.Jobs."Client Facility ID" = Replace('VALUEOF(NQ_SESSION."cf_list")', ''', ' ') but it is throwing an error in the expression builder itself.
Now I ran out of ideas and seeking any help/guidance from you folks.
I know this is a very lengthy post as I tried to explain the situation as clearly as possible. I hope someone can assist me in resolving this. Thanks for your Time...
-Dineecan't you make a custom table in the DWH? or use a VPD? Maybe a parameterised database view? What I mean is try to push your logic to the database.
regards
John
http://obiee101.blogspot.com -
Time Format using text variable with replacement path
Hi Friends,
I've used "Text variable with replacement path" to make the column heading dynamic by replacing the values referring from "0calday"...
everything is working fine, but here it is displaying the time format like
YYYYMMDD (20030101), i want it to be displayed DDMMYYYY (01012003) in the column heading... how to make it possible?
pls waiting for ur inputs, it's an urgent...
Regards,
PattnaikHi Satyakam,
In the text variable properties make sure that in the replacment path you have chosen "Text" to appear date as per user setting . Other wise as in your case it must be set to "Key" which always shows in the format YYYYMMDD.
Hope that helps.
Regards
Mr Kapadia -
How to use bind variables with XMLTABLE?
I tried to use bind variables with xmltable statment. Here, my testcase:
create or replace function wsdltest return xmltype as
l_dummy xmltype;
l_stt clob;
l_name varchar2(500);
l_xml clob;
BEGIN
l_xml :=
'<definitions name="F1" targetNamespace="http://xmlns.oracle.com/orawsv/XFILES/F1" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/orawsv/XFILES/F1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/XFILES/F1" elementFormDefault="qualified">
<xsd:element name="SVARCHAR2-F1Input">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="A-VARCHAR2-IN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="F1Output">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RETURN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="F1InputMessage">
<part name="parameters" element="tns:SVARCHAR2-F1Input"/>
</message>
<message name="F1OutputMessage">
<part name="parameters" element="tns:F1Output"/>
</message>
<portType name="F1PortType">
<operation name="F1">
<input message="tns:F1InputMessage"/>
<output message="tns:F1OutputMessage"/>
</operation>
</portType>
<binding name="F1Binding" type="tns:F1PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="F1">
<soap:operation soapAction="F1"/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="F1Service">
<documentation>Oracle Web Service</documentation>
<port name="F1Port" binding="tns:F1Binding">
<soap:address location="http://localhost:8080/orawsv/XFILES/F1"/>
</port>
</service>
</definitions>';
-- OK
l_stt := 'select * from xmltable(XMLNAMESPACES(''http://www.w3.org/2001/XMLSchema'' AS "XSD", default ''http://schemas.xmlsoap.org/wsdl/''),
''//definitions/types/XSD:schema/XSD:element[@name="SVARCHAR2-F1Input"]''
passing xmltype(:1)
columns
ab xmltype path ''.'' ) t';
EXECUTE IMMEDIATE l_stt INTO l_dummy using l_xml;
-- ERROR ORA-01006
l_name := '"SVARCHAR2-F1Input"';
l_stt := 'select * from xmltable(XMLNAMESPACES(''http://www.w3.org/2001/XMLSchema'' AS "XSD", default ''http://schemas.xmlsoap.org/wsdl/''),
''//definitions/types/XSD:schema/XSD:element[@name=:2]''
passing xmltype(:1)
columns
ab xmltype path ''.'' ) t';
EXECUTE IMMEDIATE l_stt INTO l_dummy using l_xml, l_name;
return l_dummy;
END;
Any idea ?
Thanks in advance
CyrylWhy are you using dynamic SQL statements? Why not just use something like this instead in your PL/SQL. I also replaced the leading // in your Xpath with just / since you start from the root node.
select *
INTO l_dummy
from xmltable(XMLNAMESPACES('http://www.w3.org/2001/XMLSchema' AS "XSD", default 'http://schemas.xmlsoap.org/wsdl/'),
'/definitions/types/XSD:schema/XSD:element'
passing xmltype(l_xml)
columns
ab xmltype path '.' ) t;Also, the above returns two rows, which I suspect is not what you want. Here is the pure SQL version for you to debug.
select *
from xmltable(XMLNAMESPACES('http://www.w3.org/2001/XMLSchema' AS "XSD", default 'http://schemas.xmlsoap.org/wsdl/'),
'/definitions/types/XSD:schema/XSD:element'
passing xmltype('<definitions name="F1" targetNamespace="http://xmlns.oracle.com/orawsv/XFILES/F1" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/orawsv/XFILES/F1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/XFILES/F1" elementFormDefault="qualified">
<xsd:element name="SVARCHAR2-F1Input">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="A-VARCHAR2-IN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="F1Output">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RETURN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="F1InputMessage">
<part name="parameters" element="tns:SVARCHAR2-F1Input"/>
</message>
<message name="F1OutputMessage">
<part name="parameters" element="tns:F1Output"/>
</message>
<portType name="F1PortType">
<operation name="F1">
<input message="tns:F1InputMessage"/>
<output message="tns:F1OutputMessage"/>
</operation>
</portType>
<binding name="F1Binding" type="tns:F1PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="F1">
<soap:operation soapAction="F1"/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="F1Service">
<documentation>Oracle Web Service</documentation>
<port name="F1Port" binding="tns:F1Binding">
<soap:address location="http://localhost:8080/orawsv/XFILES/F1"/>
</port>
</service>
</definitions>'
columns
ab xmltype path '.' ) t -
Page Specific Persistence using Session Variables
Hi, I have read a lot about using session variables to persist the ReportDocument object across page loads. This works fine if you have just one page open with one report. The problem I am having is I have a web application that makes 30 or 40 different reports available to the user. To simplify the code and make it easier to add new reports I have developed a single template aspx page that can be used to view any of the reports.
My problem is that if the user opens 2 different reports in 2 separate tabs in the browser then the session variable persistence doesn't work because the session variable is available to both tabs.
Is there a way to persist the ReportDocument object which is 'page' specific.
ThanksYour best option is likely to have something that makes the session variable names unique. I've done such things as putting the current datetime in the url as a querystring parameter and appending that to the variable name. On each postback that querystring should persist.
You might be able to use the reportclientdocument object and serialize the report and persist through view state, haven't tried this with inproc ras though. A sample that uses the ras sdk can be found [here|http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples] -
Using session variable in init. string of session variable init. block
hi, experts,
is it allowed to use a loaded session variable (A) in the initialization string in the initialization block of another session variable (B).
for example,
in the execution precedence of initialization block of B, added the initialization block of A
then in the initialization string in the initialization block of B,
the sql likes:
select yyy from a where a.xxx = 'valueof(nq_session.A)'
what is the correct syntax?
thank you very mucH!That's the correct format. If it is not working for you then you need to give more information as what's happening, how you populate your Init Blocks etc.
-
Hi Gurus,
What is the use of row wise initialization when we have go for this can i have one scenario for better under standing.
Thanks,Check these
http://gerardnico.com/wiki/dat/obiee/row-wise
http://docs.oracle.com/cd/E12103_01/books/admintool/admintool_Variables6.html
http://obiee10grevisited.blogspot.com/2012/03/row-wise-initialization.html -
Can we use session variables in BI publisher's Data Model SQL Query?
Hi Experts,
We need to implement Data level security in BI Publisher 11g.
In OBIEE we do so by using session variables, so just wanted to ask if we can use the same session variables in BI Publisher as well
ie can we include the where clause in the Data Models SQL Query like
Where ORG_ID = @{biServer.variables['NQ_SESSION.INV_ORG']}
Let me know your views on this.
PS: We are implementing EBS r12 security in BI Publisher.
ThanksRead this -> OBIEE 11g: Error: "[nQSError: 23006] The session variable, NQ_SESSION.LAN_INT, has no value definition." when Creating a SQL Query using the session variable NQ_SESSION.LAN_INT in BI Publisher [ID 1511676.1]
Follow the ER - BUG:13607750 - NEED TO BE ABLE TO SET A SESSION VARIABLE IN OBIEE AND USE IT IN BI PUBLISHER
HTH,
SVS
Maybe you are looking for
-
Check for updated file in physical drive and if exists then call procedure?
hi i want to check on local drive in 1 folder if upated file is there and then start my batch process which will load data from that file. so how to check if that file is present in location and its upated one is there any utiliy in oracle ???? Reply
-
Digital copy of a movie, cant find the transferred version
I recently got Robin Hood and it came with a digital copy version, so i popped it into my computer and attempted to put it on my ipod nano. I went through the steps and entered the code in itunes, but i cant find the movie now and when i try again It
-
Why doesn't the loop exit?
I have my program prompting the user for a code in letters. System.out.print("Enter Code: "); code = TextIO.getlnString(); code = code.toUpperCase(); //uppercase so I don't have to code for small letters tooFollowing this I'm using a while loop to ch
-
Message mapping currently being edited by user
Hi Friends, I want to edit a message mapping but I facing the information that mapping is currently edited by user This is my user itself. I close my all XI sessions and login then also I face the same error. I also tried through XI home page -> Admi
-
Is there a way to buy something from an iTunes store other than my own local one?
Is there a way to buy something from an iTunes store other than my own local one?