Focal Point
Running a Managed Reporting Standard Report using APIs

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7751056991

December 04, 2006, 11:51 AM
sathyanveshi
Running a Managed Reporting Standard Report using APIs
Hi,

I was referring to WebFOCUS API Developer's Reference Version 7 Release 1.3 for
running a standard report. The document has a piece of code which does that.

We have a parameter driven report which we would like to run using APIs. Can you
provide me with some code to run this parameter-driven report?

Cheers,
Mohan
December 04, 2006, 02:54 PM
Kerry
Hi Mohan,

Can you please let us know, what API(s) are you looking at? Have you considered about using WebServices in this case? If I can know a little more about what you are looking for, I will be more than happy to make further suggestions.

Cheers, Smiler

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
December 04, 2006, 03:16 PM
sathyanveshi
Hi Kerry,

I was referring to the API documentation that came along with the product. We have a need to build a custom jsp page which in turn picks the report parameters from a database table and run the report. Hence, we were referring to the jsp code provided in the API documentation.
The code for running a Standard Report as provided in the documentation is this:


String cgiLocation =
application.getInitParameter("webfocus_client_root")+File.separator+"web"
+File.separator+"cgi";
//Obtain a random number
double random =Math.floor((Math.random()*100000));
//Convert double into a String
String rdm = Double.toString(random);
//Create a request and response object
WFApplicationRequest workerReq = new WFApplicationRequest();
WFResponse workerResp = new WFServletResponse( response );
//Instantiate the WFServletVariableTableExtension to add name/value pairs
to the request
WFServletVariableTableExtension wfSVTExtension = new
WFServletVariableTableExtension( request, application );
//Sign-on to Managed Reporting
workerReq.addParameter( "IBIMR_action", "MR_SIGNON" );
workerReq.addParameter( "IBIMR_user", "admin" );
workerReq.addParameter( "IBIMR_pass", "admin" );
workerReq.addParameter( "IBIMR_returntype", "XML" );
WFWorkerUtil.processRequest( cgiLocation, workerReq, workerResp,
wfSVTExtension, null ,null, null );
//Reinitialize the request with the previous response cookies and obtain
all MR Domains
workerReq.Initialize( workerResp.getCookies() );
workerReq.addParameter( "IBIMR_action", "MR_RUN_FEX" );
workerReq.addParameter("IBIMR_sub_action", "MR_STD_REPORT");
workerReq.addParameter("IBIMR_fex", "app/test.fex");
workerReq.addParameter("IBIMR_folder", "#appdomain");
workerReq.addParameter("IBIMR_domain", "untitled/untitled.htm");
workerReq.addParameter("IBIMR_random", rdm);
//workerReq.addParameter( "IBIMR_returntype", "XML" );
WFWorkerUtil.processRequest( cgiLocation, workerReq, workerResp,
wfSVTExtension, null ,null, null );
%>

Because, we have a need for a parameter-driven report, we would like to have a similar piece of code which runs a report with parameters. Especially, I would like to know the corresponding workerReq.addParameter() function that does the job.

Cheers,
Mohan
December 04, 2006, 04:37 PM
Kerry
Hi Mohan,

Can you please try this:
workerReq.addParameter( "PARMNAME", "PARMVALUE" );

For example:

workerReq.addParameter( "COUNTRY", "ENGLAND" );

Our internal expert reviewed your code and strongly recommends to use the WebServices API. It is better documented and has better examples. Based on the WebFOCUS release you are using, the following manual on WebFOCUS Web Services may be of interest:

WebFOCUS Web Services 7.1.3

Hope this helps. Smiler

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
December 05, 2006, 03:34 PM
sathyanveshi
Hi Kerry,

Thanks for your response. We were able to run the parameterized report using the API method you have provided.

Thanks again...

Cheers,
Mohan