cancel
Showing results for 
Search instead for 
Did you mean: 

Modify provider via web services

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

dan_cuevas
Active Participant
0 Kudos

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);

Former Member
0 Kudos

Dan thanks so much for the sample code. I found that my code wasn't working due to a bug in XI R2, XI 3.0, and XI 3.1! Tested the code with FP4.5 for XI R2 and it worked. There doesn't appear to be the same fix for XI 3.0 or XI 3.1 yet.

ted_ueda
Employee
Employee
0 Kudos

I can confirm that the issue with QueryService modifyDataProvider (tracking ADAPT01113234) has been fixed with XI Release 2 FixPack 4.5 or Service Pack 5, and is slated for the next Service Pack for XI 3.x.

Sincerely,

Ted Ueda

Former Member
0 Kudos

I did get it working with FP4.5 for XI R2. But I really need it working in XI 3.1. Any chance you have an ETA or an approx date on when an SP will come out for that?