Tag Archives: designer

Printing LoV names with Designer COM SDK

Tutorial “Getting started with Designer SDK”

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

        static void Main(string[] args)
        {
            Application application = new Application();
            application.Interactive = false;

            CleanUpMethod cleanUp = delegate { application.Quit(); };
            Console.CancelKeyPress += delegate { cleanUp(); }; // to handle Ctrl+C

            try
            {
                application.Logon("Administrator", 
                    "", "localhost", "secEnterprise");                
                Universe universe =
                    application.Universes.OpenFromEnterprise(
                        "webi universes",
                        "Island Resorts Marketing",
                        false);
                PrintClasses(universe.Classes, "");
                universe.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                cleanUp();
            }
        }

        static void PrintClasses(Classes classes, String path)
        {
            foreach (Class theclass in classes)
            {
                String path2 = path + "/" + theclass.Name;
                foreach (Designer.Object theobject in theclass.Objects)
                {
                    if (theobject.HasListOfValues)
                    {
                        Console.WriteLine(path2 + ";" 
                            + theobject.Name + ";" 
                            + theobject.ListOfValues.Name);
                    }
                }
                PrintClasses(theclass.Classes, path2);
            }
        }

    }
}

Getting Started with Designer SDK in C#

You will need:

  • BusinessObjects Enterprise XI 3.x: You need BusinessObjects client tools installed on your PC, and a connection to a BusinessObjects server.
  • Visual Studio C#: You can install Microsoft Visual Studio Express from http://www.microsoft.com/express/downloads/.
  • Create new project: File > New Project… > Console Application
  • Add reference to the SDK: Project > Add Reference… > COM > BusinessObjects Designer 12.0 Object Library
  • Now you can start coding!

Getting started

The Designer SDK is quite simple and easy to use. Universe Designer API Reference is all you need to solve almost any task (that can be solved via the SDK).

Class Application is the main class that represents the Designer product. When an instance of Application is created, Desiner is started on background, and you can see designer.exe in Task Manager. The first thing you usually do starting Designer is logging in. The same should be done in the program using either function LogonDialog() or Logon(UserName, password, CMS, authenticationMode). In the end the program should quit the Designer, otherwise the designer.exe will stay running, even when your program finished. For this reason, your code should handle possible exceptions and quit the application before quiting the program.

using System;
using Designer;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Application application = new Application();
            try
            {
                application.LogonDialog(); 

                // ... some code here ...
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                application.Quit();
            }
        }
    }
}

Hello Universe!

The following program imports the standard universe “Island Resorts Marketing” and prints the structure of its classes.

using System;
using Designer;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Application application = new Application();
            try
            {
                application.LogonDialog();
                Universe universe =
                    application.Universes.OpenFromEnterprise(
                        "webi universes",
                        "Island Resorts Marketing",
                        false);
                Console.WriteLine(universe.Name);
                PrintClasses(universe.Classes, 3);
                universe.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                application.Quit();
            }
        }

        static void PrintClasses(Classes classes, int indent)
        {
            foreach (Class theclass in classes)
            {
                Console.WriteLine(
                    new String(' ', indent)
                    + theclass.Name
                    + " [" + theclass.Objects.Count
                    + " objects, "
                    + theclass.PredefinedConditions.Count
                    + " conditions]");
                PrintClasses(theclass.Classes, indent + 3);
            }
        }

    }
}