How to retrieve SQL query of QaaWS using BO Java RE SDK

Posted by & filed under SDK, Xcelsius.

QaaWS is stored as Webi document on the server

To check that QaaWS is represented as Webi document, you can open Query Builder and run the following SQL:


The property SI_FILES describes the location of the files corresponding to QaaWS and it is actually the WID file:

The following code prints queries for all QaaWS found in CMS:

IInfoObjects objs = infoStore.query("SELECT * FROM CI_APPOBJECTS WHERE SI_KIND='QaaWS'");
System.out.println("Number of QaaWS found: " + objs.size());
for (Object obj : objs) {
   IInfoObject infoObj = (IInfoObject)obj;
   System.out.println("------ " + infoObj.getTitle() + " ------");
   DocumentInstance widoc = wiRepEngine.openDocument(infoObj.getID());

The function printing SQL of Webi document

public static void printQuery(DocumentInstance widoc) {
   DataProviders dps = widoc.getDataProviders();
   for (int i = 0; i < dps.getCount(); ++i) {
      DataProvider dp = (DataProvider)dps.getItem(i);
      if (dp instanceof SQLDataProvider) {
         SQLDataProvider sdp = (SQLDataProvider)dp;
         ArrayList<TreeNode> nodes = getListOfTreeNodes(sdp.getSQLContainer(), true);
         for (TreeNode node : nodes) {
            if (node instanceof SQLSelectStatement) {
               SQLSelectStatement query = (SQLSelectStatement)node;

Auxiliary functions

The following function finds the list of all nodes in the tree. It might be more convenient then writing recursion:

public static ArrayList<TreeNode> getListOfTreeNodes(TreeNode root, boolean onlyLeaves) {
   ArrayList<TreeNode> nodes = new ArrayList<TreeNode>();
   treeNodeTraversal(root, nodes, onlyLeaves);
   return nodes;

private static void treeNodeTraversal(TreeNode node,
   ArrayList<TreeNode> nodes,
   boolean onlyLeaves)
   if (!onlyLeaves || node.isLeaf()) {
   for (int i = 0; i < node.getChildCount(); ++i) {
      treeNodeTraversal(node.getChildAt(i), nodes, onlyLeaves);

Source Code

How to Create a Folder in CMS using BO Java SDK

Posted by & filed under SDK.

public static void createFolder(
	IInfoStore infoStore,
	String name,
	String description,
	String parentCUID)
		throws SDKException
	IPluginMgr pluginMgr = infoStore.getPluginMgr();
	IPluginInfo plugin = pluginMgr.getPluginInfo(CeKind.FOLDER);
	IInfoObjects newInfoObjects = infoStore.newInfoObjectCollection();
	IInfoObject infoObject = (IInfoObject)newInfoObjects.get(0);
	infoObject.setDescription(description);, parentCUID);

Handling Ctrl+C in a C# console tool (Designer SDK)

Posted by & filed under SDK.

Handling exceptions is not enough to make clean up (quit Designer). The following code handles Ctrl+C.

using System;
using Designer;
namespace ConsoleApplication1
    class Program
        delegate void CleanUpMethod();

        static void Main(string[] args)
            Application application = new Application();

            CleanUpMethod cleanUp = delegate { application.Quit(); };
            Console.CancelKeyPress += delegate { cleanUp(); };


                // ... some code here ...
            catch (Exception ex)

Mouse pointer disappearing in Windows 7

Posted by & filed under Other.

I had a problem – my mouse pointer was disappearing after waking up computer on occasion. Nothing helped except System Restore which was not actually very neat solution as restoration also removed important system changes or software.

I spend few hours searching internet for the solution but have not found anything that solved my problem.

What worked for me was to uninstall all mouse drivers and reboot the computer.

Personal File Sharing

Posted by & filed under Python.

If you need easy accessible personal file store, there are a lot of them on the web. Another solution is to use google blobstore service – a geek's choise :)

import urllib
from google.appengine.ext import blobstore
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp.util import run_wsgi_app

class MainHandler(webapp.RequestHandler):
    def get(self):
        upload_url = blobstore.create_upload_url('/upload')
        <body style="font-family:arial,sans-serif;">
        <form action="%s" method="POST" enctype="multipart/form-data">
        Upload File:<br/>
        <input type="file" name="file"/>
        <input type="submit" name="submit" value="Submit"/>
        </form>""" % upload_url)
        for b in blobstore.BlobInfo.all():
                <a href="/serve/%s">%s</a>
                (<a href="/delete/%s">Delete</a>)"""
                % (str(b.key()), str(b.filename), str(b.key())))

class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
    def post(self):

class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
    def get(self, resource):
        resource = str(urllib.unquote(resource))
        blob_info = blobstore.BlobInfo.get(resource)
        self.send_blob(blob_info, save_as=blob_info.filename)

class DeleteHandler(webapp.RequestHandler):
    def get(self, resource):
        resource = str(urllib.unquote(resource))
        blob_info = blobstore.BlobInfo.get(resource)

def main():
    application = webapp.WSGIApplication(
          [('/', MainHandler),
           ('/upload', UploadHandler),
           ('/delete/([^/]+)?', DeleteHandler),
           ('/serve/([^/]+)?', ServeHandler),
          ], debug=True)

if __name__ == '__main__':

Cell Borders in Web Intelligence

Posted by & filed under Web Intelligence.

Web Intelligence cell borders function differently from the borders in Excel. The border in Web Intelligence can have different color from sides. For example, left of two adjacent cells can have gray right border, right can have black left border. The color of the border on the screen depends on the rendering algorithm, i.e. browser, presentation format (PDF, HTML, XLS), View/Edit mode.

To demonstrate this, let's create a report, add a table with three objects to it. Select the middle column and change its borders to be black from each side:

The result can be the following:

You can change spacing between cells and see the cells and the borders:

To make sure that borders are always displayed correctly, set the same color from both sides:

Without spacing, the border will look as desired:

How to fix "Session timed out" (Tomcat)

Posted by & filed under Administration.


  1. Stop Tomcat
  2. Edit "web.xml" files in the following folders (do not forget to make a copy before editing):
    • "[Tomcat55 Directory]\webapps\InfoViewApp\WEB-INF",
    • "[Tomcat55 Directory]\webapps\InfoViewAppActions\WEB-INF" ,
    • "[Tomcat55 Directory]\webapps\AnalyticalReporting\WEB-INF",
    • "[Tomcat55 Directory]\webapps\PlatformServices\WEB-INF",
    • "[Tomcat55 Directory]\Conf"
  3. Set the session timeout to 60 minutes
    • <session-timeout>60</session-timeout>
  4. Save and close the "web.xml" file.
  5. Clean the "Work" directory. Go into "[Tomcat55 Directory]\Work\Catalina\localhost" and delete the following temporary directories (or move somewhere):
    • AnalyticalReporting
    • InfoViewApp
    • InfoViewAppActions
    • PlatformServices
  6. Start Tomcat
  7. Launch the CMC. Login and go to the Servers tab
  8. Edit the properties for "ServerName.WebintelligenceProcessingServer" and set the following:
    • Idle Connection Timeout (minutes): = 60
    • Timeout Before Recycling (seconds): = 3600
    • Save and close
  9. Restart "ServerName.WebintelligenceProcessingServer".
  10. Test.

Configuring Eclipse on Windows to Use With Google App Engine

Posted by & filed under Python.

The post "Configuring Eclipse on Windows to Use With Google App Engine" on Google has not been updated since 2008. Here is the updated version for Eclipse 3.7 (Indigo).

Before you start, download and install the following components:

Python Google App Engine Calculator

Posted by & filed under Python.

Couple of months ago, accidentally I found myself on a conference for Python developers. I thought "what the hell am I doing here". Ok, now I got into an interesting project and have to learn Python… :)

My first program – Calculator:)

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        # build a list of operations
        f = {'+': lambda x, y: str(float(x) + float(y)),
             '-': lambda x, y: str(float(x) - float(y)),
             '*': lambda x, y: str(float(x) * float(y)),
             '/': lambda x, y: str(float(x) / float(y)),
             'C': lambda x, y: "",
        # get page parameters
        x = self.request.get('x')
        y = self.request.get('y')
        operator = self.request.get('operator')
        # calculate 
        result = ""
            result = f[operator](x, y)
        except ValueError:
            result = "Error: Incorrect Number"
        except ZeroDivisionError:
            result = "Error: Division by zero"
        except KeyError:
        # build HTML response
        buttons = "".join(["<input type='submit' name='operator' value='"
                           + o + "'>" for o in sorted(f.keys())])
            <form action='/' method='get' autocomplete='off'> 
            <input type='text' name='x' value='%s'/><br/>
            <input type='text' name='y'/><br/> 
            </html>""" % (result, buttons))

app = webapp2.WSGIApplication([('/', MainPage)], debug=True)