Saturday, June 27, 2009

Stored Procedure in WebI Reports Part 3


Image walkthrough: Stored Procedure with Parameters / Prompts in WebI Reports


[1] We are starting with this WebI report which was created with a simple stored procedure, in Part 2: That stored procedure just returned 2 columns. Now, we are going to work with a stored procedure with 2 input parameters, aka 'prompts' (in WebI). Very useful.



[2] Our 2nd stored procedure returns 2 columns, based on users' response. The parameters are 'StateID' and 'StateAbbrev' - with datatype of number and string / varchar, respectively. And since we know where these 2 fields are from, a quick way to test this procedure would be to find and enter 2 valid parameters when executing the procedure, in this case, we'll pick '3' for state 'AR'.

Let's run the procedure:
Usage format:

EXEC Stored_Procedure StateID, StateAbbrev

EXEC Stored_Procedure 3, AR

> see results of this procedure at the bottom of the following pic



[3] So, back to WebI > SQL (View SQL) > Use Custom SQL:

We'll apply our store procedure: EXEC Stored_Procedure 3, AR

make sure, to use "SET NOCOUNT ON" and comment out (/* blah blah */) the codes generated by WebI - do NOT delete the codes.

Validation successful.



[4] Run it and the report runs. So, we got it to work. Don't worry about the column headers, you can rename them to suit your needs.

Now, let's create prompts.


[5] We'll use both types to be Alphanumeric

This your basic @Prompt syntax:
@Prompt(‘message’,‘type’,[lov],[MONO|MULTI],[FREE|CONSTRAINED])

So we have

-- EXEC Stored_Procedure 3, AR (Original format)

EXEC Stored_Procedure
@Prompt('Enter STATE ID' , 'A' , MONO , FREE , PERSISTENT) ,
@Prompt('Enter STATE ABBREVIATION' , 'A', MONO , FREE , PERSISTENT)

... And validation successful. Great.



[6] As we save and run the above modified WebI query, we are prompted - perfect! So, we'll once again enter '3' and 'AR' to match with the results we got when we ran this procedure on SQL M our result in SQL Server Management Studio.



[7] So, now let's run this stored procedure with prompts on WebI - bingo, Success!


[8] NOTE:

If you go back to the code, you'll see that the @Prompts are gone in custom SQL query. Don't worry, simply "close" the code and the report will still prompt you. BUT, if you hit "save", then it will only retain the value you see - in this case '3' and 'AR'.


Thursday, June 25, 2009

Scope of Analysis and Custom Hierarchies

Video: Demystifying Scope of Analysis and Custom Hierarchies on Business Objects XI Universes and WebI / DeskI reports.

The terms "Scope of Analysis" and "Custom Hierarchies" sound so complex and sophisticated that one would think that wow... Business Objects got some very advanced futuristic features. I, of course do not deny that these are amongst the most useful features of BOE, but they could've used simpler terms, like 'custom drill down' or 'drill down settings' - sounds much friendlier and less terrifying.

If you are in the field of Business Intelligence - using any BI tool, you've probably come across drill downs in reports. Well, in BOE, drill down options, or custom hierarchies, as they call it, is defined in Universes - which in turn, reflect in DeskI or WebI reports.

For example, you may be creating a sales report and your database has records for last 5 years, by year, quarter, month and so on. By default, drilling down on this report would let the users dynamically view the results like this:

Level 1:

Year Sales
2009 500

Level 2:

Quarter Sales
3 150

Level 3:

Month Sales
11 70

...and so on.

But, let's say your CIO is either lazy or simply doesn't care about the quarters and would like to drill down from Year level to Month level to Week level - skipping Quarter level. This customization of drill down is what is known as 'custom hierarchies' in a BO universe and when it is used in a WebI / DeskI report, it is called the mysterious 'scope of analysis'. Wow, big deal...

Let's see a quick video walkthrough:







Wednesday, June 24, 2009

Stored Procedure in WebI Reports Part 2

WALKTHROUGH: Using Stored Procedure in WebI reports on Business Objects EN XI R2 (SP3)

This is a follow up of Part 1 where we went through the prerequisites of enabling stored procedure queries on WebI.

We have a simple Stored Procedure called "uspGetStates" - which is intuitive and does exactly what the title says - it gets names of states.

Stored Procedure: dbo.uspGetStates

Running the procedure: EXEC dbo.uspGetStates will give you results like this:

(partial result)

AA 53
AE 52
AK 1
..
..
so on (see pic)

This store procedure returns 2 columns - one with 'string' datatype and the other with 'number'.
If you can recall that your WebI query panel must have the same number of columns - i.e. Dimensions and same number of corresponding data types as your stored procedure does. Else your procedure won't validate, and thus won't work on WebI.

[1] So, we run the procedure and got some result


[2] We have to create a WebI Report with the same structure as our procedure returns



[3] Use the codes:

a) "SET NOCOUNT ON" on top of the code generated by WebI
b) Comment out - but, DON'T delete your WebI code
c) At the bottom of the comment, use your store procedure - in this case we'll use: "EXEC dbo.uspGetStates"



[4] Uh oh ... Error ! Type mismatch. Let's reslove



[5] We used:

"Company" which has "string" datatype - good
"Saleareanum" which also has "string" datatype - no good

So, we'll use:
"Saleareaid" which has "number" datatype




[6] Having corrected the Dimensions' datatype and matching them with those of the stored procedure, we are ready to validate.



[7] Validation successfull !


[8] We run our WebI report and see that our report returns the same data as it return running the stored procedure on SQL Server Management Studio.. (null row is displayed on WebI as the last row).




Stay tuned for Stored Procedure with Prompts in Part 3 ...

Stored Procedure in WebI Reports on BOE Part 1

How to use Stored Procedure on Web Intelligence (WebI) reports on Business Objects XI R2 ?

I found the following info in Bob forum and elsewhere on the net.

STEPS:

Applicable to universes that are built with ODBC or OLEDB connections.

[1] Locate the ODBC.SBO or OLEDB.SBO files
[2] Usual Location:

DRIVE:\BusinessObjects Enterprise 11.5\win32_x86\dataAccess\connectionServer\
DRIVE = your installation drive - be it C:\ , D:\ or something else.

/*
So, if BOE is installed in your D:\ drive then, the ODBC and OLEBD SBO files will be located in the following location:
D:\BusinessObjects Enterprise 11.5\win32_x86\dataAccess\connectionServer\odbc
D:\BusinessObjects Enterprise 11.5\win32_x86\dataAccess\connectionServer\oledb
*/

[3] Change parameter Force SQLExecute in "ODBC.SBO" to "Always"



[4] Add parameter Force SQLExecute = Always into OLEDB.SBO

> You can do the same on on the OLEDB.SBO file if need be

[5] Create query in WebI with the same structure your SP returns

> Same structure = same data types and equal number of columns

[6] Change SQL to following


Change your code from the WebI Query Panel > SQL > Custom:

SET NOCOUNT ON -- add exactly like this

/*SELECT any_field FROM any_table*/ -- this is the code generated by WebI

EXCE Your_Stored_Procedure @prompt('enter value','A',)
-- this is your stored procedure


That looks simple. Now let's have a quick walkthrough. Stay tuned for Part 2 ...

Monday, June 15, 2009

On the fly Case Statements in Web Intelligence Reports


Problem:
Due to having a little flaw in the data (in database) duplicate rows are being produced in (WebI) reports.

(1) Solution:
Use CASE statements


> 122 Unique WorkItem subtypes

One of the the WorkItem SubTypes has a duplicate

'Problematic Payment - Overage '
'Problematic Payment - Overage'

One with and an extra space.

In the WebI Report - it is the following Dimension: (click view SQL)

WORKITEM.WORKITEMSUBTYPE, (here WORKITEMSUBTYPE is the Dimension - i.e. Column)

RESOLUTION: Go to

CASE WHEN WORKITEM.WORKITEMSUBTYPE NOT IN ('Problematic Payment - Overage ' ,'Problematic Payment - Overage')
> anything other than the two types above

THEN WORKITEM.WORKITEMSUBTYPE
> use the original value from database

ELSE 'Problematic Payment - Overage'
> otherwise, use 'Problematic Payment - Overage' - meaning, combine/sum the corresponding values of those two cells into one cell

END WORKITEMSUBTYPE,
> finish this (Case statement) logic and name this column as WORKITEMTYPE

-- WORKITEM.WORKITEMSUBTYPE
> I commented out the existing Dimension

This way, my column name is Identical to the Dimension name and thus the report runs fine and groups those two types into a single cell and eliminates the duplicate row.

Note: when you hit 'validate' - make sure, it prompts you with new LOVs (lis of values); else, it doesn't gets rid of the prompts. I've seen the exact same behavior in Crystal Reports too.

2nd solution: though this is a temporary fix, the same exact Case needs to be applied to our Universe so that it the duplicate problem will be eliminated in all WebI reports.

3rd / best solution: request DBAs so they permanently cleanse this data

On the fly Case Statements in Web Intelligence Report: Image Walkthrough

1) Duplicate row located



2) Go to Edit Query > SQL (view SQL) : Locate the corresponding dimension / column



3) Insert your Case statement and comment out the dimension



4) Validate




5) Make sure, it prompts you with new LOVs (list of values); else, it gets rid of the prompts (and runs off of cached LOVs, I think). I've seen the exact same behavior in Crystal Reports too.




6) Verify validation



7) Duplicate row is summed to original row


8) Before and after shots

Saturday, June 13, 2009

-maxChildReqs Business Objects Job Server Child settings

If you are a Business Objects Administrator, you should definitely have a look at this. Whenever a report, be it WebI or Crystal, is scheduled, it is processed by it's respective Job Server. And if you or any BOE users with 'schedule' or higher rights need to schedule any report for multiple users, i.e. which generates multiple instances, you should use the " -maxChildReqs " function at the end of the command line of the job server(s) from Central Configuration Manager (CCM) of BOE XI. Failure to do so will affect your Business Objects environment due to Job Server Childs (JobServerChild.exe) not releasing the system memory. JobServerChilds are generated from Job Servers to process multiple report requests. However, they do not terminate or shut down right away without the -maxChildReqs command. Though they terminate after 2 hours of inactivity in XI, at approximately 40 MBs each, several dozens of these will surely choke your available system RAM.


I've gone ahead and made a simple video showing the before and after behavior of a BOE test environment consisting of 1 Crystal Reports Job Server in a dual core server. Crystal Report Job Servers can only process a maximum of 5 simultaneous jobs per CPU and since we have dual core, 2 CPUS-our max would be 10. I ran a simple Crystal Report for about 25 people to see how the job server handles the situation. Enjoy...




The following information is taken from "BusinessObjects XI Release Notes". Google it and read it from SAP site for further information.


...


The following lists information on job server settings:

• -maxJobs

Sets the maximum number of concurrent jobs processed by one job

server.

• -type

Presets the job server type. Can be OUTPROC or MIXEDPROC.

OUTPROC causes the job server children to shutdown after every

job (like CE10 report job servers), MIXEDPROC causes the job

server children to shutdown after every 100 jobs.

• -maxChildReqs

Sets the maximum number of jobs processed by one job server child

before it shuts down and restarts (in case you want a to use a

number between 1 [OUTPROC] and 100 [MIXEDPROC])

Job server children will also automatically shut down if left unused for a period longer than 2 hours.


...

Thursday, May 28, 2009

How to Email Scheduled Reports in Business Objects

Working in a Business Intelligence environment, you certainly come up with requests from users where they want so and so reports to be emailed to them. They are too lazy to go to their Infoview's Inbox. You should know, if you don't already, reports are delivered by the Job servers - Crystal Reports are emailed via Crystal Reports Jobs Sever and WebI reports are delivered via Web Intelligence Job servers. So, here is a image walk through of the steps to set up the Job Servers' so you can schedule reports and send them out to users' emails. I created a dummy WebI report called "WebI Email Test".

1) We have a typical Web Intelligence report here and we're viewing it's location in Infoview so we can run it here.



2) Let's run it, no prompt or anything like that, plain and simple.



3) Let's go to Central Management Console (CMC) and schedule this report to be emailed to a user.



4) Move onto "Schedule" tab.



5) Let's set it to Microsoft Excel format, i.e. Schedule this report to be delivered / emailed in MS Excel format.



6) Destination 1: Now we need to up the Destination for this to be scheduled report. In this case, we'll be Emailing this report. From the drop down menu, select "Email (SMTP)". Then click on the radio button next to the "Set the values to be used at schedule time here:" .

Enter an email address to be sent "From" and email address(es) to be sent "To", along with CCs if any.



7) Destination 2 - Go / scroll down a bit. In the "Subject" - we'll select "Title" from the drop down menu next to where it says "Add a placeholder for a variable property"and simply "Add" it so that the recipient(s) can see the Title of the report as their Subject line. You can select any of the other available properties like ID, Owner, Datetime, User Full Name, Email Address. I will also check the box for "Attach object instance to email message", so that a copy of the report is also attached to the recipients emails. I mean, what's the point of emailing from Business Objects users, if there are no attachments right?



8) Let's click on "Schedule" once more and we'll just do a one time schedule to run now. You can of course, and will most likely will have to schedule as per the user requirements, be it daily, weekly, monthly or based a some specific dates selected in a custom Calendar (I'll try to create a mini tutorial on how to schedule repors using Calendars, someday; it's pretty easy).



9) So it's "Pending", sometimes you may see "Pending" or the status just may show as "Running".



10) Since it took only 10 seconds, by the time I hit "Refresh" the report already "Failed" and thus I couldn't see the "Running" status.



11) Upon clicking on "Failed", we see the error at the bottom that says, "Error Message: destination DLL disabled. CrystalEnterprise.Smtp:" .



12) That basically means that the Email (SMTP) is not enabled for the appropriate job server; in this case, Web Intelligence Job Server(s) because we are scheduling a WebI report to be emailed. Let's go to "Servers" and enable the EMAIL destination for the available Web Intelligence Job Servers.



13) Go to the "Destinations" tab and we see, Email (SMTP) is RED flagged - i.e. disabled. Go ahead, click on the box left of it and hit "Enable".



14) Now click on "Email (SMTP)" and set up the email properties, including Domain, Server, From, To and any other properties - you'll want to consult with one of you system admins / analyts at this stage.



15) Scroll down and add the Title as the Subject also select "Attach object instance to email message" -- this will be the default behavior for all outgoing emails using this Web Intelligence Job Server.

*** Remember, if you have multiple WebI Job Servers, you'll have to enable all of their Email (SMTP) from the Destinations tab just like above.



16) Let's go back to the report in CMC.




17) And we will reschedule it once more.



18) There's our initial "Failed" one and right below it, is our "Pending" current report.



19) And success! This is the actual email and the attached report in Excel Format. Look at the subject, it says "WebI Email Test" -- and that's the title of this report.



So, there you go. That was a walk through of how to set up the Email feature in Business Objects Enterprise XIR2 so that reports can be scheduled and report instances can be emailed out to recipients.