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

CurrentDate in a Detail filter

Started by Esperanza, 04 May 2015 01:18:33 PM

Previous topic - Next topic

Esperanza

Hello Cognos Experts!

Before running the report, I want to test if we are the first day of the month or not, if yes, then I want to run the report for the previous fiscalPeriod.

Here is what I put in the a Detail filter expression :

if (current_date=_first_of_month (current_date))
then
([GM].[Dim Time Fiscal].[Fiscal Month Id]=?p_Period?-1)
else
([GM].[Dim Time Fiscal].[Fiscal Month Id]=?p_Period?)
I always got this error
RSV-SRV-0042(see attachement)
------------------------------------------------------------------------------------

I don't understand because the condition work well in a dataItem
if (current_date=_first_of_month (current_date))
then('YES') else
('No')

cognos810

Hello CognosTuner,
I believe, your filter expression should be as such...

[GM].[Dim Time Fiscal].[Fiscal Month Id] =
if (current_date=_first_of_month (current_date))
then
(?p_Period?-1)
else
(?p_Period?)


-Cognos810

Lynn

Quote from: CognosTuner on 04 May 2015 01:18:33 PM
Hello Cognos Experts!

Before running the report, I want to test if we are the first day of the month or not, if yes, then I want to run the report for the previous fiscalPeriod.

Here is what I put in the a Detail filter expression :

if (current_date=_first_of_month (current_date))
then
([GM].[Dim Time Fiscal].[Fiscal Month Id]=?p_Period?-1)
else
([GM].[Dim Time Fiscal].[Fiscal Month Id]=?p_Period?)
I always got this error
RSV-SRV-0042(see attachement)
------------------------------------------------------------------------------------

I don't understand because the condition work well in a dataItem
if (current_date=_first_of_month (current_date))
then('YES') else
('No')

I would generally avoid case or if/else logic in a detail filter. Try using an expression that evaluates to a Boolean situation.


(
  current_date = _first_of_month (current_date)
  and
  [GM].[Dim Time Fiscal].[Fiscal Month Id] = ?p_Period?-1
)
or
(
  current_date <> _first_of_month (current_date)
  and
  [GM].[Dim Time Fiscal].[Fiscal Month Id]=?p_Period?
)