BusinessObjects Board

How to get the list of universes using a universe connection

Hi,

I would like to find the list of universes using a universe connection. To do so i ran the below two queries in Query builder & with some manual work, i am able to get this data. (attached the screenshot for sample output of first query)

select SI_CONNUNIVERSE from ci_appobjects where SI_NAME = ‘UnvConnectionName’

select SI_NAME from ci_appobjects where SI_ID in (SI_IDs manually copied from the SI_CONNUNIVERSE field)

But I would like to know how I can achieve the same in .net SDK, which class I need to use to capture those SI_IDs from the first query

Please let me know how can I achieve this.

Thanks,
CK
SI_CONNUNIVERSE.doc (90.0 KB)


Chandru 901 :india: (BOB member since 2007-07-20)

Try this:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CrystalDecisions.Enterprise;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SessionMgr boSessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
        EnterpriseSession boEntSession = boSessionMgr.Logon("username", "password", "cms name", "secEnterprise");
        InfoStore boInfoStore = (InfoStore) boEntSession.GetService("InfoStore");
        String query_connection = "select * from CI_APPOBJECTS where SI_NAME='connection name' AND SI_KIND='MetaData.DataConnection'";
        InfoObjects boInfoObjects_connection = boInfoStore.Query(query_connection);
        if (boInfoObjects_connection.Count > 0) {
            InfoObject boInfoObject_connection = boInfoObjects_connection[1];
            Property boProperty_SI_CONNUNIVERSE = (Property) boInfoObject_connection.Properties["SI_CONNUNIVERSE"];
            Property boProperty_SI_TOTAL = (Property) boProperty_SI_CONNUNIVERSE.Properties["SI_TOTAL"];
            int[] universeIDs = new int[(int)boProperty_SI_TOTAL.Value];

            String sUniverseIDs = "";
            String sIndex = "";
            for (int i = 1; i <= (int) boProperty_SI_TOTAL.Value; i++) {
                if (!sUniverseIDs.Equals("")) {
                    sUniverseIDs += ", ";
                }
                sIndex = i.ToString();
                sUniverseIDs += boProperty_SI_CONNUNIVERSE.Properties[sIndex].Value;
            }
            
            String query_universe = "select * from CI_APPOBJECTS where SI_ID IN (" + sUniverseIDs + ")";
            InfoObjects boInfoObjects_universe = boInfoStore.Query(query_universe);
            if (boInfoObjects_universe.Count > 0) {
                InfoObject boInfoObject_universe = null;
                for (int i = 1; i <= boInfoObjects_universe.Count; i++)
                {
                    boInfoObject_universe = boInfoObjects_universe[i];
                    Response.Write(boInfoObject_universe.Title + "<BR>");
                }
            }
        }


    }
}

darcstorm :philippines: (BOB member since 2008-07-22)

Thank you very much for this useful code!

It helped me on how can we get a inside values of a resulting field like SI_CONNUNIVERSE & SI_WEBI.

Thanks Again,
CK


Chandru 901 :india: (BOB member since 2007-07-20)

Is there a way to combine the 2 queries listed by Chandru, and obtain the list of all universes and their connection IN ONE SHOT?


pl80 (BOB member since 2012-09-18)