cancel
Showing results for 
Search instead for 
Did you mean: 

Getting all webI reports in a folder and its sub-folders using java sdk.

Former Member
0 Kudos

hi,

I need a java code to get the Id of all webi reports in a folder and recursive sub folders .

Is there any sample code or tutorial available for It?

regards,

nitin

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Actually, a better query might be:

SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='WebI' AND SI_ANCESTOR=<search folder SI_ID>

SI_ANCESTOR should be set to the SI_ID of a folder that is the "root" for your search. It will return all objects of SI_KIND='kind' that is a child of SI_ANCESTOR, including all sub-folders.

HTH.

Edited by: codeguru on Aug 22, 2011 5:54 PM

aasavaribhave
Advisor
Advisor
0 Kudos

I didn't test this but it should work. Import required packages.


<%
String username = "administrator";
String password = "<password>";
String cmsname = "<cmsname>";
String authtype = "secEnterprise";

IEnterpriseSession oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype);
IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("","InfoStore");
getWebi(oInfoStore,0,out);
oEnterpriseSession.logoff();
%>
<%!
public void getWebi(IInfoStore oInfoStore, int sourceFolderID, javax.servlet.jsp.JspWriter out)
{
try
{
	String query = "select * from ci_infoobjects where si_kind='webi' and si_instance =0 and si_parentid =" + sourceFolderID ;
	IInfoObjects oInfoObjects = oInfoStore.query(query);
	for(int i=0;i< oInfoObjects.size(); i++)
	{
		IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
		out.println(oInfoObject.getID() + "  " + oInfoObject.getTitle() +"<br>");
	}

	String query = "select * from ci_infoobjects where si_kind='folder' and si_parentid = " + sourceFolderID ;
	oInfoObjects = oInfoStore.query(query);
	for(int i=0;i< oInfoObjects.size(); i++)
	{
		IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
		getWebi(oInfoStore, oInfoObject.getID(), out);			
	}
	
}
catch(SDKException e)
{
	out.println(e.toString());
}

}
%>