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

Automate a Filter

Started by NettlesD, 04 Sep 2020 09:25:28 AM

Previous topic - Next topic

NettlesD

Is there a way to automatically select the items in a filter?  Meaning, I can write a Calculation that returns the last 5 years of a year.  I can name that Calculation "Years".  Is there a way to within the Calculation to "check" those 5 years so that the Calculation "Years" can be used as a filter?

Right now, on the Dashboard, I must click "Filter" and then "check" each year.  What I want to do is write the Calculation and somehow  be able to "check" those values so that it's automatic when it comes to filtering the data without me having to manually "check" each year.

dougp

I'm confused.  Do you need to create a filter that always give you the last 5 years?

[my year] > _year (current_date) - 5

Or are you saying you need the prompt page to always load with the most recent 5 year values selected in a value prompt.  This would be done using JavaScript.
Go to https://github.com/dougpulse/Cognos/ , go to CognosScripts and look at Prompts.js and related.

NettlesD

#2
No, I already have the logic for the last 5 years.

This is for a Dashboard so I'm not certain it pertains to prompts.

New -> Dashboard -> Blank Template

I create a "New Calculation" and name it "Last 5 Years" and add in the year logic and save.  If I add "Last 5 Years" to "local filters" none of the years are selected.  I then have to click "filter" and then "check" each of the 5 years.  This has to be done manually.

What I want to happen.

I want the calculation "Last 5 Years" to have all the years to be "checked" when I save it.  So, when "Last 5 Years" is used as a filter then all the years are checked without me having to "click" "filter" and then manually "checking" all 5 years.


Unless, what you are saying, that "Last 5 Years" would automatically filter the Dashboard by those last 5 years because the calculation is only looking at the last 5 years.  It would seem that you still have to click on "Last 5 Years" and click "Filter" and still "check" all 5 years to filter the Dashboard.

dougp

What version of Cognos Analytics?  If you're using 11.1.7, maybe this will help:

QuoteIBM® Cognos® Analytics includes JavaScript APIs to enable you to develop applications to extend, leverage, and automate Cognos Analytics dashboard functionality.
https://www.ibm.com/support/knowledgecenter/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ca_api.doc/c_ca_api_js.html
https://ibm.github.io/ca-dashboard-js-api/index.html