Manipulating Web Intelligence schedule properties via sdk in bulk
Many a times a requirement may come to change the existing schedules of all users or change all the schedules of one user. e.g change the extension from xls to xlsx of all the schedules in the environment. Change the “to” user emails of all the schedules of a particular user. Now the solution is to go manually and change each schedule. The problem is you can’t change the current schedule. You will have to replace the current schedule with the new one because of the limitations of schedule modification.
Here is the utility I use for such kind of schedule manipulation. In the example below I changed the extensions of all my schedule attachments to XLSX from XLS. The XLS files only hold 65000 rows and XLSX around 1 Million so you can see the obvious benefits there.
The highlighted fields shows the extension given by the user. However if you go and check all the schedules which are created in BO 2.0, and BO 3.0 they will also have .xls extension. So you will need to change the extensions in the bulk.
Below are the steps
1. Create a jsp file using the below code – The logic is pretty simple. Login to CMS, Retrieve the Schedule you want to manipulate and change the properties/values to your requirements. Clean and simple
<%@ page import = “com.crystaldecisions.sdk.occa.infostore.*” %>
<%@ page import = “com.crystaldecisions.sdk.framework.*” %>
<%@ page import = “com.crystaldecisions.sdk.properties.*” %>
<%@ page import = “java.lang.*” %>
<%@ page import = “java.util.*” %>
IEnterpriseSession es = null;
String user = “Administrator”;
String password = “Secure09”;
String cmsName = “localhost:6400”;
String cmsAuthType = “secEnterprise”;
es = CrystalEnterprise.getSessionMgr().logon( user, password, cmsName, cmsAuthType);
iStore = (IInfoStore) es.getService(“”, “InfoStore”);
oInfoObjects = (IInfoObjects)iStore.query(“Select * from CI_INFOOBJECTS Where si_recurring=1”); //recurring instance whose email needs to be changed
for(int i=0; i<oInfoObjects.size();i++)
oInfoObject = (IInfoObject) oInfoObjects.get(i);
ISchedulingInfo schedulingInfo = (ISchedulingInfo)oInfoObject.getSchedulingInfo();
IProperties properties = (IProperties)schedulingInfo.properties();
IProperties destination = (IProperties)properties.getProperties(“SI_DESTINATIONS”);
IProperties internal = (IProperties)destination.getProperties(“1”);
IProperties schedulingOptions = (IProperties)internal.getProperties(“SI_DEST_SCHEDULEOPTIONS”);
IProperties outputFiles = (IProperties)schedulingOptions.getProperties(“SI_OUTPUT_FILES”);
IProperties outputFilesProp = (IProperties)outputFiles.getProperties(“1”);
out.println(“<b>Recurring Instance Name:</b><br>”+oInfoObject.getTitle());
out.println(“<b>Recurring Instance ID:</b><br>”+oInfoObject.getID());
out.println(“<b>Result Before Update:</b><br>”+embedName);
out.println(“<b>Result how it should look after Update:</b><br>”+result);
out.println(“<b>Result after Update:</b><br>”+result);
2. Run this Jsp page on tomcat server by creating a new web application. There easy and simple steps to do that –
a. Create a folder called “Name of Your Choice” at tomcat server location D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps
b. Copy the attached JSP file to BO tomcat server at the location(the folder you just created) D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\“Name of Your Choice”
c. Create a folder called “WEB-INF” inside the folder “The one you created in step a” and copy the folder “lib” from D:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.X\java path inside the WEB-INF folder.
d. Copy all the files from D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\“Name of Your Choice”\WEB-INF\lib\external to D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\“Name of Your Choice”\WEB-INF\lib
e. Restart the tomcat server and utility is good to be executed.
f. To Execute:
Go to url http://localhost:8080/“Name of Your Choice”/Name_of_the_JSP_file.jsp
3. You can manipulate other fields of the schedule as well. Just research little bit about the field properties and the methods associated with it.
We have used this utlity with BO4.0 and BO4.1 and it works like a charm. I think this should work with BO4.2 as well but we have not tested it on 4.2. Thanks