Author Topic: Framework Manager - Filtering huge relational data  (Read 340 times)

Offline mvkvivek

  • Associate
  • **
  • Join Date: Oct 2020
  • Posts: 1
  • Forum Citizenship: +0/-0
Framework Manager - Filtering huge relational data
« on: 29 Oct 2020 01:20:03 pm »

I am very very new to Cognos. For the past 10 days I am working on this. I should say learning. I was asked to migrate existing cognos reports (based on SQL) to framework.

In my project, I imported a table (has 22M rows), created Query Subject with required columns (just 4 columns). Tried to add a filter to bring only small set of data. The filter is based on date and I am look for only today. The problem is if I hard code the filter value like this

[relational_db].[QUERY_SUBJECT_NAME].[MY_KEY]  > '20201028'

It works. It only picks only required rows.

To make it dynamic I used like this

[relational_db].[QUERY_SUBJECT_NAME].[MY_KEY]  > year(current_date) || month(current_date) || day(current_date)

When I test this it is long time to execute finally I am getting a timeout issue.

I tried similar filter in other table which has only 2k records and it worked fine.

How can I make this filter dynamically changing based on the current date?


Offline BIengineer

  • Full Member
  • ***
  • Join Date: Sep 2020
  • Posts: 9
  • Forum Citizenship: +0/-0
Re: Framework Manager - Filtering huge relational data
« Reply #1 on: 30 Oct 2020 02:57:50 am »
This is honestly something I would implement in Cognos instead - utilizing a parameter prompt for running the report (either a from-to date filter, or select a single day to filter for).

Restricting the data from FM too much makes the point of a re-useable package a little bit lost. You might need to filter for today only for this one report, but then comes a time when you want another report with the same data, except for showing historical data as well - then you might as well use the same model, filtered for different dates on Cognos level. Even though your table is 22M rows large, that does not mean it queries the entire thing in Cognos: depending on the top-level filters you define in Cognos, you can query out a subset of your table.

My suggestion for a solution in Cognos:

* Create a prompt page, add a Date filter and name the date parameter for the user to input.
* When setting up your report queries, you can add a detail filter using the date column from your FM-package, and filter it according to the date prompt parameter, like:

.[DateColumn] = ? Input_date ?

or for a date range filter (requiring two date filters, thus two input parameters):

.[DateColumn] >= ? Input_date_1 ? AND
.[DateColumn] <= ? Input_date_2 ?


If you absolutely need it done in FM, then you need to clarify a bit.

[relational_db].[QUERY_SUBJECT_NAME].[MY_KEY]  > '20201028' would yield fields starting from the date '20201029', and the filter:

[relational_db].[QUERY_SUBJECT_NAME].[MY_KEY]  > year(current_date) || month(current_date) || day(current_date) searches for rows having a day "larger" than today.
If you need rows exactly for today, you either need to use the inclusive operator >= or simply =

In your test table with 2k rows, what date rows did it select for you, and which date did you filter for?

Offline adam_mc

  • Statesman
  • ******
  • Join Date: Mar 2012
  • Posts: 295
  • Forum Citizenship: +14/-0
Re: Framework Manager - Filtering huge relational data
« Reply #2 on: 30 Oct 2020 08:35:56 am »
I would do this by creating a Parameter Map that is based on a Query Subject that returns values of a number of significant dates eg. Today, Yesterday, Tomorrow, Last Year Today, etc...

Then, I would use the value of the appropriate date I need retrieved as a macro as the filter in my Query Subject.

So a query subject with following SQL would be basis for the Parameter Map (shows Todays Date as a number only):

                'TODAY_TY' as PARM,
                to_number(to_char(a.CAL_DT, 'yyyymmdd')) as VALUE
                [EDW].CAL_DT a
                a.CAL_DT = current_date

Then, once you've completed your Parameter setup, you would add the filter [relational_db].[QUERY_SUBJECT_NAME].[MY_KEY]  >= #$[Your Parameter Name]{'TODAY_TY'}# to your query subject.

This should not time-out as it passes the value of the date rather than the calculation of the date which will be performed against every row you are comparing against.

Hope this helps,