Query Builder

New Query Builder Guide Version Published – Includes XI 3.x Updates and Relationship Functions

I have finally completed my nearly 3-month long update to our Query Builder Guide. Like most things I do, the deeper I got into it the more I found that needed work.

What kept me going, and delaying my previously promised delivery time, was the realization that aside from Ted Ueda‘s famous blog entries on Path Queries and Relationship Functions, I was building the only “how-to” guide for those Query Builder and SDK Query functionalities. I dug a little deeper into each one and broke them down into their basic components, making it easy to understand how to use them and to also be able to respect their limits.

I decided that this version of the guide was such a milestone for the guide that I jumped straight paste the 1.1 version and splurged on bestowing it with the 1.2.0 Version. The truth is that the guide itself grew by 50% in file size! Yes, I added that much new textual content!

Click here to order the latest Business Objects XI Query Builder Guide

This new version includes numerous additions to bring the guide current up to Business Objects Enterprise XI 3.1. However, for those of you not yet on BO XI 3.x, please take note of something I explain clearly in the guide:

“Query Builder is based on the BOE SDK and both tools in their BO XI 3.1 versions support all of the older methods and syntax used in BO XI R2. In fact, syntax that was labeled as deprecated in XI R2 continues to function even in XI 3.1. It is certain that XI 3.x brought some new functionality, and this guide will distinguish these, but rest assured most of what you can do in Query Builder is applicable to all BO XI releases.”

In fact, BO XI R2 administrators will greatly benefit from the newly added “Relationship Queries” section. This nearly secret functionality take Query Builder to a whole new level.

Future Customers

For the many of you to whom I committed to deliver this BO XI 3.x guide update earlier, I apologize for my tardiness and I sincerely thank you for your patience and understanding. To those of you still on the fence about whether or not to get this guide, I believe I have now packed it with enough value to make your decision a “no-brainer”.

Click here to order the latest Business Objects XI Query Builder Guide

Current Customers

To the now hundreds of you who have already purchased a previous version of our Query Builder guide, thank you again for your business and come get your free updated version. Please refer to your order confirmation email to obtain the instructions on how to get your COMPLETELY FREE updated guide. If you have any trouble, just email us and we will get it for you ASAP.

Future Improvements Coming Still

If left in a vacuum I might never publish any updates because I would never feel they are complete. This time is no different. I wanted to include more sample queries for Relationship Queries and Path Queries, but I decided it was better to publish the guide now that those tutorial sections are complete and then publish another version when I have added some additional, wonderful samples of each. As you can see, we are always working to improve this guide.

OK, now I think I will publish this little posting and get on with what is left of my beautiful Saturday afternoon. I hope someone out there appreciates my little sacrifice. ;-)


In Business Objects how can I get a list of reports using a specific universe?

I have been asked the following related questions a few times in the past months and I thought it would be a good idea to post a public answer to them. First the questions:

  • Is there any way to get a list of reports that are using a specific universe?
  • If I change this universe which reports will be affected?

The Answer – Yes, Definitely, Using Query Builder

The short answer to these questions is “Yes, you can”. The slightly longer answer is, “Yes, this can be done through Query Builder, the BO Auditing data*, or through the Business Objects SDK.” For the purposes of this article, I will confine my further comments to the Query Builder and BO Auditing data solutions; the BO SDK solution requires a set of skills and even licenses that many BO Developers and Administrators do not possess.

I haven’t been keeping track, but I expect that those who have emailed me this question have not studied The Best Query Builder Guide Ever Written. I just wanted to point out that our Query Builder Guide answers these questions, and provides so much more.

The Resolution using Query Builder

For those of you familiar with SQL or just the concept of tables you might think that all you have to do is join up the record of the specific universe with all of the records of the reports where it is used. Well, this is partially true. Firstly, if you know something about query builder you know that reports and universes are stored in separate logical tables and you know that you can’t really join two tables together. The solution here is two part: (1) query the record for the specific universe retrieving all associated report IDs and then (2) query for for each of those report IDs to get the reports’ identifying information.

Query the Universe’s Reports

This is a straightforward query, but be careful if you do not have the universe’s object ID, because it is possible to have two universes with the same name and you wouldn’t want to get wrong data from the start. Here is the SQL statement you need to put in Query Builder:

SELECT
si_id,
si_name,
si_webi,
si_cuid
FROM
CI_AppObjects
WHERE
si_name = 'UNIVERSE_NAME' AND
si_kind = 'Universe'

From this you will get some additional universe info and a list of all reports that are bound to this universe. Copy that list of report object IDs to a text editor and proceed.

Query the Report’s Identifying Information

Take that list of report object IDs from the previous step and parse the list so that each ID is separated by a comma. Then substitute that list for the string “111111,222222,33333 below in the SQL:

SELECT
si_id,
si_name,
si_universe,
si_cuid
FROM
CI_InfoObjects
WHERE
si_id IN (111111,222222,33333) AND
si_kind = 'WebI' AND
si_instance = 0

The output should be your desired list of reports. Now that you see the “si_universe" property you might ask yourself why I don’t query the report table for my universe’s object ID. Good idea, but Business Objects’ Query Builder query language doesn’t yet support filtering on “property bags”, and si_universe, just like “si_webi” are property bags. They hold multiple values in a single property.

The Resolution using BusinessObjects Auditing Data

If you have enabled auditing on your environment’s report servers then you can look to your Auditing data for an answer to this question. However, auditing data is not meta data; it’s records are created as the objects are used. Therefore if a report is never used then it will not be present in this data set. If this is not a concern, or if you would like to know which reports have been used belong to a certain universe, then querying the auditing data is an option for you.

Querying the Auditing Records

There are many ways to mine this data source for the data you need. For most folks the best, easiest method is to use the “Activity” universe. Here you will find the objects you need. A tutorial on this universe and the auditing data is out of scope here, but I’d like to put together a guide on the topic if I hear of any interest. Another way to mine your data is directly against the database tables (these tables are not encrypted like the Business Objects XI CMS Infostore. This certainly allows for better query tuning, but it will increase the complexity for you. You could even use the SQL of a report created against the “Activity” universe as a starting point, but be careful as that universe is full of derived tables.

Final Thoughts

Both of these steps might seem difficult at first, but with a little practice you will find that you can whip out answers to these kinds of questions rather quickly. In fact, now you have the tools to answer the reverse as well: “How can I get a list of universe using a specific set of reports?”. Now you know, and knowing is half the battle.


Have You Heard of Path Queries in Query Builder?

Did you know that there is a tweak that you can do to your Business Objects server’s Query Builder main page “query.jsp” so that it can handle “Path Queries”? Do you know what a “Path Query” is? Do you know why you should care about “Path Queries”?

I was originally introduced to Path Queries by a posting at an SAP Business Objects Blog on the topic by Ted Ueda. The article got me really excited to try out this new syntax and seemingly simpler method of querying my CMS metadata.

Path Queries are very different from SQL queries and they are basically written like this path://InfoObjects/Root Folder/My Folder/*. This simple example would return all of the objects in the “My Folder” folder. Cool, huh?

Path Query syntax actually gets a lot deeper. It allows you to specify relationships between objects (the above example defaults to a parent-child relationship), specify filters, sort order, and they can even function as a kind of sub-select. For example, returning all groups for which the user Administrator is a member.

If you would like to learn more, keep an eye out for future articles on Path Queries or better yet, get your hands on our popular “Query Builder Guide” which completely explains Path Queries and the exciting SQL “Relationship Queries”.


Using BO Query Builder to Detect Report-Universe Binding Status

The loss of binding between reports and universes is a common problem experienced by BO XI users. Often the issue can go unnoticed for quite a while, but like a dormant disease it can spontaneously begin to demonstrate severe symptoms that can result in the loss of your report. Sound serious enough? It is! The following article is intended to help you detect report-universe unbinding proactively, before they cause you serious trouble.

The best tool for detecting of Report-Universe Binding Status is Query Builder. As far as I know there is no third part tool or BO utility for this other than Query Builder, but honestly, Business Objects’ Query Builder works quite well and it is available to you for free. Here and the queries that you will need:

Business Objects Query Builder Query: Universe Binding Status

This query brings back a limited set of properties for the desired universe. I lifted it from our Query Builder Guide. Like most problems there are multiple ways to attack and starting by looking to the universe is one way.

SELECT
si_id,
si_name,
si_webi,
si_cuid
FROM
CI_AppObjects
WHERE
( si_name = '' OR si_id = ) AND
si_kind = 'Universe'

You need to put in the universe name (upper or lower case is not important) or the Object ID of the universe (most people are more familiar with name, but object ID (si_id) provides more precise results. From this query we will see only the reports to which this universe is bound. It won’t list the reports to which it should be bound. The report name nor the report’s query name are given here, but the reports si_id or object ID is given here. And so you my need to do some additional queries to identify the reports listed here. Which leads us to the other way to start looking at this issue.

Business Objects Query Builder Query: Report Binding Status

For many people this is the query they will lead with in QueryBuilder. Usu

SELECT
si_id,
si_name,
si_universe,
si_cuid
FROM
CI_InfoObjects
WHERE
( si_name = '' OR si_id = OR si_parentid = ) AND
si_kind = 'WebI' AND
si_instance = 0

Using the query will require you to provide at least one of the following: report name (si_name), report object ID (si_id), or parent folder object ID (si_parentid). This query’s result will list all of the universes to which the report(s) is/are bound. How can a report be bound to more than one universe? Multiple queries in the report (also called the classic name of “data providers”). This fact makes this query the most important query in my opinion. If it fails to list an expected universe then you have identified and unbound report. My sympathies and congratulations!

What does an Unbound Report Look Like in Query Builder?

Words are often not as valuable as pictures. Now pictures of words, well their value is questionable, but not in this matter. The following image show what the report Query Builder query looks like when a report is showing that it is bound to its universe (just a single universe in this example):

Query Builder output of a report properly bound to its universe

Query Builder output of a report properly bound to its universe


In the rather unfortunate case that a report is not bound to its universe you will see output that looks like this:
Query Builder output for a report not bound to ANY universe

Query Builder output for a report not bound to ANY universe


Note:This query will return only WebI or Web Intelligence reports. You will need to modify it if you are interested in other reports in your CMS InfoStore.
blank space creating image
blank space creating image

A Note About the Query Builder “si_universe” Property

Many properties in Query Builder are compound in nature, meaning they have multiple values for a single object. For example and report can have multiple universe and in fact its si_universe property has multiple sub-properties (si_total and the universes’ object IDs). We call properties like si_universe property bags. The unfortunate fact here is that in Query Builder you cannot filter on a property bag. Therefore, you cannot create a query that only returns all of the unbound reports. :-(

What about the CUIDs?

If you have read my other articles such as “Business Objects XI – Changing BO Report / Universe Relationships” then you know that the relationship between reports and universes is really at the CUID level and not the Object ID level. Well, the truth is that Object IDs are specific to an environment, but CUIDs are portable between environments (with the write methods). Anyway, Query Builder and the CMS InfoStore will show the binding at the Object ID level, but this binding will look different in another environment to which you have correctly and successfully migrated the report and universe because the Object IDs will be different (but the CUIDs will be the same). Anyway, for now, just know that the CUID is very important with regards to report-universe binding; however, when detecting the status of that binding they are not important.

Important Note about Business Objects’ Import Wizard

I said earlier that there was no other tool for identifying unbound reports, but I fibbed a bit. It is possible to use Business Object’s Import Wizard to detect unbound reports. If you select a report and the option to automatically select its universes then if Import Wizard fails to select all of the expected universes you know that the report is in an unbound state. This is a tedious way to detect report-universe unbinding, BUT if you find yourself using Import Wizard and you are experiencing an issue with Import Wizard selecting reports’ universes then you have a good indicator that something is probably wrong with the report-universe binding.

Knowing is Half the Battle

The next logical question is, “Now that I have identified an unbound report, how can I correct it?”. That my friends is a topic for another article. My family and hobbies are calling to me now; please remind me if I forget to write that article soon.

Want to Know More About Query Builder?

I recommend that you take a look at our “Business Objects Query Builder Guide“, it is most likely “The Most Complete Business Objects XI Query Builder Guide Ever Written” and it will help you to discover and master the secrets of Business Object’s Query Builder, such as the one discussed in this article.


A Favorite from Query Builder – Active User List

Sometimes you can’t get Business Objects’ Central Management Console (CMC) to return the “Metrics” page and you need to know how many users are logged in to the system. Other times the CMC “Metrics” page works, but in the case of system administration, you may want to know who is logged in to your Business Objects XI CMS InfoStore. In either case, your best bet is to turn to BO Query Builder for the information you need.

In an effort to avoid artificial suspense building let me give you the query first and then tell you a little about it if you still have the time to read further:

blank space creating image

SELECT TOP 3000
*
FROM
CI_SystemObjects
WHERE
si_kind = 'Connection' AND
si_parent_folder = 41 AND
si_authen_method != 'server-token'
ORDER BY
si_name

blank space creating image

About the Query

This query returns all of the information available in the CMS InfoStore for all users that are currently logged in. The results are presented alphabetically by user name. IMPORTANT NOTE: the results will not be filtered by distinct user; therefore if a user account is used by multiple people or multiple applications are used you can expect to see multiple logins. The field si_lastlogontime might be useful in making sense of multiple entries.

At the moment I am writing this I started to wonder if scheduled jobs created by a user result in a login returned by this query. I will look in to this and follow-up if someone doesn’t already test this out and leave a comment.

I invite you to play with this query and try to figure out what is so magical about “si_parent_folder = 41“. Please share your thoughts and discoveries by leaving a comment here. I also recommend that you take a look at our newly published “Business Objects Query Builder Guide“, it is most likely “The Most Complete Business Objects XI Query Builder Guide Ever Written” and it will help you to discover and master the secrets of Business Object’s Query Builder, such as the one discussed in this article.


Business Objects Query Builder Functions: Max, Min, and Sub-Queries

If you have spent some time with Business Object’s Query Builder you may have arrived at the conclusion that the SQL that it supports is rather simplistic. I don’t blame you, when I first started using Query Builder I felt the same was after spending just a few hours struggling with the tool. Most of the QB queries that I could find on the Internet were rather simplistic and they left me thinking that the tool was much more limited than it really is.

Case In Point: Getting the Functionality Max and Min Functions and Sub-Queries

If you have used SQL with databases you no doubt know that the functions MAX and MIN are quite popular and powerful. Logically they return the maximum or minimum value of a particular field. In Query Builder the functionality is a little different, but maybe in a good way. When this functionality is invoked all of the records with the maximum or minimum value for the particular field are returned.

The following syntax excerpt was swiped from our “Business Objects Query Builder Guide“, let’s review it and continue our discussion:

blank space creating image

MAX and MIN and Much More
The ALL operator can be quite powerful and a bit confusing. It allows you to get as close to a sub-query, or MAX and MIN functions, as is possible with Query Builder.
The ALL operator should only be used between two properties or fields that are of the same data type. ALL can be used to identify the maximum or minimum value when used in conjunction with two of the same properties. When used with different fields or properties it can be used to compare property 1 to all possible values of property two.

Operator Syntax
= ALL
!= ALL
> ALL
>= ALL
< ALL
<= ALL

Examples
SELECT * FROM CI_InfoObjects WHERE si_children >= ALL si_children
(returns all info objects with the maximum number of children in the repository)

SELECT * FROM CI_InfoObjects WHERE si_id != ALL si_parentid

(finds all info objects that are not parents of other objects)

blank space creating image

Query Builder MAX and MIN Functionality, not Functions

OK, busted, you got me. Their are no exact MAX and MIN functions that you drop into a SELECT clause. HOWEVER, in your WHERE clause all that you need to get the functionality is to combine the >= and <= operators with the special "ALL” operator. This operator essentially launches a sub query for all values of the valid and same data type property which follows it. Well, you get the point.

Didn’t I Say Something About Using a Sub-Query in Query Builder?

If the operators >= and <= result in MAX and MIN functionality when compared with the same property then what might happen if we try other operators or even different properties on both sides of the "ALL" operator. The various possible combinations are numerous, but you must remember that the compared properties must be of the same data type. I also believe that you are limited to valid properties of the same logical table, for example you cannot compare report properties to universe properties because they come from different logical tables (ci_InfoObjects and ci_AppObjects). Some of the combinations will produce interesting results, such as those given in the last example above.

I invite you to play with these and share your thoughts, discoveries, or comments here in the comments of this post. I also recommend that you take a look at our newly published "Business Objects Query Builder Guide", it probably is "The Most Complete Business Objects XI Query Builder Guide Ever Written" and it will help you to discover and master the secrets of Business Object's Query Builder, such as the one discussed in this article.


Officially Released: The Best Business Objects XI Query Builder Guide Ever Written!

Perhaps a few visitors to BusinessObjectsTip.com have already noticed that we posted a new guide for BO XI Query Builder on the site last month. Due to some technical difficulties and lots of other lame excuses there was trouble finding and ordering the guide. These obstacles have been overcome now and I would invite you to check out “The Best Business Objects XI Query Builder Guide Ever Written!” We know that you will find it valuable and that it will turn you into a Query Building Genius!

Collage of pages from the Business Objects Query Builder Guide

Query Builder: Improving Query Performance

Business Objects Query Builder is a free application provided with Business Objects Enterprise XI (BOXI). It is uses the BOE SDK to provide a simple web user interface for submitting queries against the CMS InfoStore and returning their results.

Query Performance Concerns: Indexed Properties

As you begin to experience the wonders of Query Builder you will find that certain queries run quickly and other run very slowly, or not at all. It is important to remember that you are still querying a database and certain portions of that database have been indexed for improved performance in Business Objects. Among the lucky indexed properties you should find the following. For improved performance use these in your query’s selection criteria (WHERE clause):

SI_CUID
SI_GUID
SI_HIDDEN_OBJECT
SI_ID
SI_INSTANCE_OBJECT
SI_KIND
SI_NAME
SI_NAMEDUSER
SI_NEXTRUNTIME
SI_OWNERID
SI_PARENTID
SI_PLUGIN_OBJECT
SI_RECURRING
SI_RUID
SI_RUNNABLE_OBJECT
SI_SCHEDULE_STATUS
SI_UPDATE_TS
SI_INSTANCE

Optimizing Query Builder Queries

Query performance is improved by using indexed properties in your selection criteria (WHERE clause); however, the order of these can additionally optimize your query’s performance. All selection criteria with indexed properties should be placed first in the WHERE clause. The BusinessObjects Enterprise CMS InfoStore, and therefore Query Builder, processes queries from top to bottom and left to right. Therefore the selection criteria should also be ordered from the most restrictive to the least restrictive. For example, SI_NAME = ‘My Report’ should be place before SI_KIND = ‘WebI’ in the query. It may not be the prettiest query but it will be the fastest.

For example:

SELECT
si_id,
si_name,
si_universe,
si_cuid
FROM
CI_InfoObjects
WHERE
si_name = '' AND
si_kind = 'WebI' AND
si_instance = 0