Tuesday, August 28, 2012

Writeback Analysis in OBIEE 11g - part 1

writeback –> ability to modify data that is displayed in an analysis in oracle answers.  very crude way of putting it. Please refer to the OBIEE docs from Oracle for the limitations.

Interestingly, this contradicts the basic concept of an OLAP system, which is primarily meant for fetching data rather than inserting data. However there are some special cases, where you would want this functionality. There are certain design considerations too that are involved with the data warehouse, which we will discuss in another post.

I’m creating a demo table for this purpose

create table JT_DEMO_WRITEBACK
(
    CUST_KEY    NUMBER  PRIMARY KEY,
    CUST_NAME VARCHAR2(255) NOT NULL,
    CUST_RATING NUMBER NOT NULL
);

lets insert some data to look like this:

image

Login to Oracle Answers. got to Administration page. Under security click the “Manage Privileges” link

image

change the “Write Back to Database” privilege

image

image

start the BI Admin Tool and open your rpd. In the physical layer, create a new connection pool called “WB Connection Pool”. Import this table. create an alias for this table.

image

disable caching on your physical table that you want to write back to.

image

create a new Business Model to look like this

image

we want the Customer Rating field to be editable(writable) in our Answers page.

image

Create the new subject area in the presentation layer as shown below. for simplicity purpose, I’m setting an implicit fact for the WB Test Subject area.

image

set the permission to read write for the relevant users

image

save your rpd and check for consistency.

Enable writeback in the configuration file by Modifying  the instanceconfig.xml file located in $(ORACLE_INSTANCE)\config\OracleBIPresentationServicesComponent\coreapplication_obips1

add the following to the instanceconfig.xml file

<WebConfig xmlns="oracle.bi.presentation.services/config/v1.1">
   <ServerInstance>
      <!-- added by JT -->
      <LightWriteback>true</LightWriteback>

</ServerInstance>
</WebConfig>

Deploy your rpd and restart the BI services.

create a new Analysis as shown

image

go to the Advanced tab and note the column ids in the xml code. we will use these ids in our xml template to specify the SQL to update the customer rating field.

image

In the criteria tab, mark the customer rating column writable ( this option is enabled in Answers if you enabled the writable flag for the column in the rpd).

image

go to results tab –> edit view (pencil icon) –> Table view properties (the xyz icon) and enable writeback option and specify the template name

image

create your template file which contains the SQL code for the update.

<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">

<WebMessage name="wb_cusRating">
<XML>
<writeBack connectionPool="WB Connection Pool">
<insert> </insert>
<update>
UPDATE BISAMPLE.JT_DEMO_WRITEBACK SET CUST_RATING=@{c8f6dc321eca7766c} WHERE CUST_KEY=@{c6657b10f6946b91b}
</update>
</writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>

save the above text to a new file called writebacktemplateJT.xml put it in the location $(ORACLE_INSTANCE)\bifoundation\OracleBIPresentationServicesComponent\coreapplication_obips1\analyticsRes\customMessages

note:

  1. you may want to create customMessages directory if it does not exist.
  2. the line <WebMessage name="wb_cusRating"> specifies the template name.
  3. save your analysis to a folder as “WB Test”.

Restart OPMN services. login to Answers page with the user, whom you have given the necessary rights. open the “WB Test” analysis

image

notice that the Cust Rating  field is editable, change the value and click on the update button. OBIEE updates the data to the physical database and refreshes the page with the new values.

image

image

note: you might get the writeback error in red as shown below

image

There seems to be a bug with the write back feature in OBIEE 11g. A patch
is currently available only for 64 bit Win systems. Bug 13067844, Patch
13067844. After installing the patch, the writeback works properly.

5 comments:

Dev said...

Hi Jonathan,

Not sure whether you are watching your blog.

I have OBIEE 11.1.1.6.4 installed on my Win 64 Bit Machine.

I followed your blog step by step few days back and I was successfully able to update CUST_RATING.

I am doing it again now and its not working. Its giving the following error:

Write Back Error
An error occurred while writing to the server. Please check to make sure you have entered appropriate values. If the problem persists, contact your system administrator.

I don't understand, how it had worked earlier. I don't have the previous RPD. But I am doing exactly as mentioned in your blog.

Is it a permission issue ? Data type issue ? Column ID Issue ?

Any suggestions/advice will be highly appreciated.

Thanks n Regards
Dev

Jonathan Thomas said...

Hi Dev,

I was not following the blog for some time. I know its been a long time, but did you get over the error? I don't think it is a permission issue since i assume you would have made the field writeable and given the necessary permissions (else it would have not worked in the first place ! ). can you check with Oracle support if any patching has to be done? To my knowledge the patch was meant for 11.1.1.5

Sriram Karthik said...

In the beginning of the blog, it was said that to refer the Oracle docs for finding the limitations of Obiee WriteBack. Can you please post some of the links to read about the limitations of write back.

Jonathan Thomas said...

Hi Sriram,

you read here about the limitations of the writeback feature. http://docs.oracle.com/cd/E25178_01/bi.1111/e10541/answersconfigset.htm#i1018289

Anonymous said...

Great help, worked like a charm