Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

There have been many requirements about getting the full folder location of all the reports(crystal/webi/deski) in the enterprise system. The information can be figured out using the query builder by executing multiple queries but it becomes time consuming as well as difficult when this information has to be retrieved for a large number of reports.

Using Query Builder


Using the query builder(AdminTools Application), and execute the below query
SELECT SI_ID,SI_NAME,SI_PARENTID FROM CI_INFOOBJECTS WHERE SI_KIND IN('cryatalReport','Webi','Deski') AND SI_INSTANCE=0, you get to list the id, name and parentId of all the crystal/webi/deski reports. The SI_PARENTID property bag contains the id of the object which is parent for a particular report. In basic scenarios, the parent of a report can be a folder, objectpackage, FavoritesFolder or an Inbox.

Again executing the below query in the query builder you can get the name of the parent.
SELECT SI_ID,SI_NAME,SI_PATH FROM CI_INFOOBJECTS WHERE SI_ID=<Parent-Id retrieved from the previous query>

If the above query returns a folder(SI_KIND=Folder), then the SI_PATH property bag contains the hierarchy of folders. i.e it contains the name of the folders this object belongs to. The SI_PATH property bag has a sub property bag "SI_NUM_FOLDERS" which contains a numeric value and it lets you know the number of folders this partcular folder has as its parents in hierarchy.

Consider a report is inside an objectPackage, then the parent of the report becomes an object package who inturn has a parent as a folder.
Thus using the query builder, this becomes a two step query.
First, to get the parentid of the report, then to get the name of the object package and get the parent id of the object package and then again execute a query to get the folder name and path.

Using BusinessObjects Enterprise SDKs

The below code lists folder path of all the reports(crystal/webi) in the enterprise system.

Note:

For other scripts and information on how to run these scripts see here:

Scripts and Samplesshawn.penner/blog/2013/06/04/scripts-and-samples

Get Folder Path

<%@ page import="com.crystaldecisions.sdk.properties.*" %>
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.crystaldecisions.sdk.plugin.desktop.folder.*" %>
<%@ page import="java.util.*" %>

<html>
<head></head>
<body>
<table border="2" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<th width="30%">Report Name</th>
<th width="10%">Report Id</th>
<th width="40%">Folder Path </th>
</tr>
<%
IEnterpriseSession es=null;
try
{
String CMS = "localhost:6400"; //CMS Name 
String UserID = "Administrator"; //Administrator User Account 
String Password = "";   //Administrator Password

ISessionMgr sm = CrystalEnterprise.getSessionMgr();
es = sm.logon(UserID, Password, CMS,"secEnterprise");

IInfoStore iStore = (IInfoStore)es.getService("","InfoStore");

String sq = "select si_id,si_name,si_parentid from ci_infoobjects where si_kind in ('CrystalReport','Webi') and si_instance=0";

IInfoObjects iObjects = iStore.query(sq);
IInfoObject iObject = null;

for(int i=0;i<iObjects.size();i++)
{
  iObject = (IInfoObject)iObjects.get(i);
  out.print("<tr><td>" + iObject.getTitle() + "</td><td>" + iObject.getID() + "</td>");
  IProperties prop = iObject.properties();
  IProperty getProp = prop.getProperty("SI_PARENTID");
  String FolderID = getProp.toString();
  IInfoObjects folder = iStore .query("select si_id,si_name,si_parentid,si_path from ci_infoobjects where si_id=" + FolderID);
  IInfoObject ifolder=(IInfoObject)folder.get(0);   
  if(ifolder.getKind().equals("Folder"))
  {
   IFolder iifolder=(IFolder)ifolder;
   String finalFolderPath="";
   if(iifolder.getPath()!= null)
   {
    String path[]=iifolder.getPath();
    for(int fi=0;fi<path.length;fi++)
    {
     finalFolderPath = path[fi] + "/" + finalFolderPath;
    }
    finalFolderPath = finalFolderPath + iifolder.getTitle();
   }
   else
   {
    finalFolderPath=finalFolderPath+iifolder.getTitle();
   }
   out.println("<td>" + finalFolderPath + "</td></tr>");
  }
  else if((ifolder.getKind().equals("FavoritesFolder")))
  {
   out.println("<td><b>FavoritesFolder</b>  ::  " + ifolder.getTitle() + "</td></tr>");
  }
  else if((ifolder.getKind().equals("Inbox")))
  {
   out.println("<td><b>Inbox</b>  ::  " + ifolder.getTitle() + "</td></tr>");
  }
  else if((ifolder.getKind().equals("ObjectPackage")))
  {
   //out.println("<td><b>ObjectPackage</b>  ::  " + ifolder.getTitle() + "</td></tr>");
   IProperties prop1 = ifolder.properties();
  IProperty getProp1 = prop1.getProperty("SI_PARENTID");
  String FolderID1 = getProp1.toString();
  IInfoObjects folder1 = iStore .query("select * from ci_infoobjects where si_id=" + FolderID1);
  IInfoObject ifolder1=(IInfoObject)folder1.get(0);   
  if(ifolder1.getKind().equals("Folder"))
  {
   IFolder iifolder1=(IFolder)ifolder1;
   String finalFolderPath1="";
   if(iifolder1.getPath()!= null)
   {
    String path[]=iifolder1.getPath();
    for(int j=0;j<path.length;j++)
    {
     finalFolderPath1= path[j] + "/" + finalFolderPath1;
    }
    finalFolderPath1 = finalFolderPath1 + iifolder1.getTitle()+"/"+ifolder.getTitle();
   }
   else
   {
    finalFolderPath1=finalFolderPath1+iifolder1.getTitle()+"/"+ifolder.getTitle();
   }
   out.println("<td>" + finalFolderPath1 + "</td></tr>");
  }
  
  }
 
 
}

}
catch(Exception e)
{
out.println(e);
}
finally
{
if(es !=null)
{
es.logoff();
}
}
%>

46 Comments
Labels in this area