Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on May 06, 2011 at 01:04 PM

    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());
    }
    
    }
    %>
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2011 at 03:54 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.