on 10-16-2008 12:58 AM
Anyone know how to use web services to modify the data provider of an existing Webi report and then display the result in html or pdf in either BO XI R2 or BO XI 3.0?
I know there's a QueryService web service which contains a ModifyDataProvider method but I'm not sure that I'm using it right. Any sample snippet/code would be much appreciated.
Hi David,
Try the code snippet below.
Hope this helps.
Regards,
Dan
DocumentInformation oDocumentInformation = oReportEngine.getDocumentInformation(repID, null, null, null, null);
//=======================================================================================================
String[] strQueryServiceURL = oSession.getAssociatedServicesURL("QueryService");
QueryService oQueryService = null;
if (strQueryServiceURL.length > 0) {
oQueryService = QueryService.getInstance(oSession, strQueryServiceURL[0]);
}
DataProviderInformation[] oDataProviderInformation_array = oQueryService.getDataProviderList(oDocumentInformation.getDocumentReference(), true);
DataProviderInformation oDataProviderInformation = oDataProviderInformation_array[0];
QuerySpecification oQuerySpecification = oDataProviderInformation.getQuerySpecification();
QueryBase oQueryBase = oQuerySpecification.getQueryBase();
String documentReference = oDocumentInformation.getDocumentReference();
if (oQueryBase instanceof Query) {
Query oQuery = (Query) oQueryBase;
QueryObject[] oQueryObject_array = oQuery.getQueryResult();
QueryCondition oQueryCondition = new QueryCondition();
com.businessobjects.query.Filter oFilter = new com.businessobjects.query.Filter();
//out.print("Adding filter condition...<BR>");
oFilter.setFilteredObject(oQueryObject_array[1]);
out.print("Filter Object: " + oFilter.getFilteredObject().getName() + "<BR>");
oFilter.setFilterOperator(FilterOperator.Equal);
out.print("Filter Operator: " + oFilter.getFilterOperator() + "<BR>");
Operand[] oOperand = new Operand[1];
Values oValues = new Values();
String[] strConditionValue = new String[] {"2003"};
oValues.setFreeValue(strConditionValue);
oOperand[0] = oValues;
oFilter.setOperand(oOperand);
out.print("Filter Operand: " + ((Values) oFilter.getOperand(0)).getFreeValue(0)
+ "<BR>");
ConditionBase[] oConditionBase = new ConditionBase[1];
oConditionBase[0] = oFilter;
oQueryCondition.setItem(oConditionBase);
oQuery.setQueryCondition(oQueryCondition);
out.print("Executing oQueryService.modifyDataProvider()...<BR>");
DataProviderInformation oDataProviderInformation_new = oQueryService.modifyDataProvider(
oDocumentInformation.getDocumentReference(),
oDataProviderInformation.getUID(),
oDataProviderInformation.getDataSourceUID(),
oQuerySpecification,
null);
documentReference = oDataProviderInformation_new.getDocumentReference();
}
//=======================================================================================================
//empty retrieveView object to retrieve data in HTML view
RetrieveView oRetrieveView = new RetrieveView();
RetrieveData oRetrieveData = new RetrieveData();
oRetrieveData.setRetrieveView(oRetrieveView);
//retrieve images for the report using callback options
CallbackOption[] oCallbackOption = new CallbackOption[1];
ImageManagement oImageManagement = new ImageManagement();
oImageManagement.setCallbackScript("image_handler.jsp");
oImageManagement.setImageManagementHolder("imageName");
oImageManagement.setDocumentReferenceHolder("reportDocumentID");
oCallbackOption[0] = oImageManagement;
//give the callback option with the image to the view
oRetrieveView.setCallbackOption(oCallbackOption);
//set actions to be performed when retrieving report(refresh in this case)
Action[] oActions = new Action[1];
oActions[0]=new Refresh();
DocumentInformation oDocumentInformation_refresh = oReportEngine.getDocumentInformation(documentReference, null,oActions,null,oRetrieveData);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.