If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

SDK implement filters in report properties in the job

Started by Y.CROZET, 30 Apr 2015 08:16:55 AM

Previous topic - Next topic

Y.CROZET

Hello,

The objective of our solution is to create a routine through the SDK to create a set of jobs with as much step as consistently prompt combination to run our report.

Currently, we can create our job with a set of steps while changing the default job properties (see green part of the attachment).
However, we are unable to edit the red part of the attachment: The properties of the job steps to edit filters reports.

This is the Java code used to add the steps in our job (The reports table contains all paths to the reports that will be use as steps) :

JobStepDefinition steps[] = new JobStepDefinition[reports.length];

       for (int i = 0; i < reports.length; i++)
       {
             BaseClassArrayProp bcap = new BaseClassArrayProp();
             steps = new JobStepDefinition();
             StringProp searchPath = new StringProp();
             BaseClass temp = (BaseClass)new Report();

             searchPath.setValue(reports);

             temp.setSearchPath(searchPath);
             BaseClass bca[] = new BaseClass[1];
             bca[0] = temp;
             bcap.setValue(bca);

             steps.setStepObject(bcap);

             //now, add each definition to the job
             String targetJobPath = targetJobFolder.concat("/jobDefinition[@name='").concat(jobName).concat("']");
             BaseClass[] newSteps =  this.addJobStep(steps, targetJobPath);
             ...
       }
                   
               
       private BaseClass[] addJobStep(JobStepDefinition bc, String path)
       {
             AddOptions addOpts = new AddOptions();
             BaseClass jobSteps[] = new BaseClass[1];
             addOpts.setUpdateAction(UpdateActionEnum.replace);

             jobSteps[0] = bc;
             
             BaseClass newbc[] = new BaseClass[1];
             try
             {
                    newbc[0] = cmService.add(new SearchPathSingleObject(path), jobSteps, addOpts)[0];
             }
             catch (java.rmi.RemoteException remoteEx)
             {
                    remoteEx.printStackTrace();
             }
             
             return newbc;
       }

We have tried to add options in defining the step (object bc) with bc.setParameters methods (params) and bc.setOptions (options), but neither method seems to work.

/** TEST 1 **/     
ParameterValueArrayProp params = new ParameterValueArrayProp();
             
       ParameterValue [] value = new ParameterValue[4];
       ParmValueItem [] parmVal= new ParmValueItem[1];
       SimpleParmValueItem item = new SimpleParmValueItem();
       String parameterName = new String ("SCALE");
       item.setUse("1000000");
       item.setDisplay("M€");
       item.setInclusive(true);
             
       parmVal[0] = item;
       value[0] = new ParameterValue();
       value[0].setName(parameterName);
       value[0].setValue(parmVal);
             
       params.setValue(value);
       
       bc.setParameters(params);

/** TEST 2 **/
       OptionArrayProp options = new OptionArrayProp();
       Option[] optVal = new Option[1];
             
       RunOptionStringArray opt = new RunOptionStringArray();
       opt.setName(RunOptionEnum.fromString("Scale"));
       opt.setValue(new String [] { "M€"});
             
       optVal[0] = opt;
             
       options.setValue(optVal);
             
       bc.setOptions(options);

We searched in the cognos sample games without success. Do you have the technical solution to implement filters in report properties in the job?

Thanks in advance.
Yohann

Andrew Weiss

Yohann,

You're problem is with this:
   bc.setParameters(params);
   bc.setOptions(options);

You're setting the parameters and the options on the JobDefinition.  What you need to do is loop on the JobStepDefinitions and set them on each of those,  e.g.:
    steps.setParameters(params);
    steps.setOptions(options);

Using the SDK comes with quite a bit of learning curve and unnecessary challenges.  At Avnet we've developed a API and Scripting language using JavaScript to automate tasks such as these in IBM Cognos.  In addition you can interact with datasources such as databases and Microsoft Excel files so you can easily write data driven scripts.

Have a look: http://www.bspsoftware.com/products/metamanager/API/

There's a video of a recent webinar here: https://youtu.be/7Vazw2kcI84

Let me know if you're interested in a demonstration.

Thanks,
-Andy
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager

aumdy

Quote from: Andrew Weiss on 23 Jul 2015 09:45:29 AM
Yohann,

You're problem is with this:
   bc.setParameters(params);
   bc.setOptions(options);

You're setting the parameters and the options on the JobDefinition.  What you need to do is loop on the JobStepDefinitions and set them on each of those,  e.g.:
    steps.setParameters(params);
    steps.setOptions(options);

Using the SDK comes with quite a bit of learning curve and unnecessary challenges.  At Avnet we've developed a API and Scripting language using JavaScript to automate tasks such as these in IBM Cognos.  In addition you can interact with datasources such as databases and Microsoft Excel files so you can easily write data driven scripts.

Have a look: http://www.bspsoftware.com/products/metamanager/API/

There's a video of a recent webinar here: https://youtu.be/7Vazw2kcI84

Let me know if you're interested in a demonstration.

Thanks,
-Andy

That was informational. Thanks, Andy. I have a requirement to allow users to save custom report views from their client portal. Is this doable using metamanager script runner?

Current Environment: Cognos 10.2.2
Client portal uses iFrame to embed Cognos reports in the portal.
Users click on report links in the client portal, which then render the report in an iFrame on the same page.

1 - User logs into their Client Portal.
2 - Picks a report to run from existing list of report links.
3 - Report runs with default parameters and returns the output in iFrame.
4 - Report output page contains a list of value and drop-down prompts so users can change the report parameters and re-run the report if they need to.

5 - We want to add a button on the report output page to allow users to "save current view" in their MyFolder. (Assuming this would be javascript).
6 - User clicks the "save current view" button and a text box pops up to enter report name.
7 - User enters report view name and clicks save and pop up closes.
8 - Report is now saved to their MyFolders, along with current parameters.
9 - Hitting the save button should also update the client portal with the new link to the updated report view location.
10-So the next time user opens the report, the report runs with default parameters from previously saved view.
11-We also want users to be able to choose which view they would like to run, the next time they run the report (maybe limit to last 5 saved views per report?)

We have already completed Steps 1- 4. We don't have advanced java developers on this project, so I am trying to explore if I can accomplish the rest of the steps using Cognos Mashup Service or a 3rd party tool. I am also interested in metamanager script runner if it can accomplish this task. Will this tool be able to solve my problem?

Thanks!

Andrew Weiss

Aumdy,

The metamanager script runner module is a scripting tool to automate tasks using the metamanager api. This is generally used by a metamanager user or scheduled process to extract data, synchronize security or perform other tasks. For self service work we use the metamanager api directly from an aspx webpage. For example, for a customer, we built a new screen in Cognos to allow users to see what schedules they're receiving along with a button to unsubscribe them from the schedule. Using this same technique we could create buttons or other actions in your custom portal which use the metamanager api to create report views, list report views and other actions.

Please email me directly and We can discuss further.
Andrew.Weiss@Avnet.com

Thanks
Andy.


Sent from my iPhone using Tapatalk
MetaManager makes administering IBM Cognos a breeze.  http://www.bspsoftware.com/MetaManager