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

How to render two different object using date prompt

Started by tushar gaurav, 27 May 2022 12:25:31 AM

Previous topic - Next topic

tushar gaurav

Hi,

I have a date prompt in the report page itself.
I have two singleton where I need to display First of the month of report run date in first singleton(Singleton1)
and Report run date in second singleton(Singleton2).
Singleton1 should be displayed if First of the month is selected and Singleton2 should be displayed for any other dates.
For example
Scenario 1:if the report run date is 27 may 2022 and from the date prompt 1 may 2022 is selected then singleton 1 showing 1May2022 should be displayed.
Scenario 2:if the report run date is 27 may 2022 and from the date prompt 15 may 2022 is selected then singleton2 showing 27May2022 should be displayed.


Can you please help me in this scenario.

Thanks,
Tushar

oscarca

I misunderstood

tushar gaurav

Hi Oscarca,

Thanks for your response.
I have modified the query for easy understanding.
If possible can you please help me with the solution.

Thanks,
Tushar

oscarca

I solved it like this:
Created two data items:
[pDate] = #prompt('pDate','MUN','','')#
[firstOfMonth] = _first_of_month(cast(caption([p_date]) as date))

Create a boolean variable:
vFirstOfMonth = string2date(substring(ParamDisplayValue('pDate'),1,10)) = [Query2].[firstOfMonth]

Then add the render variable to the singelton that should show First of Month.

Repeat the same procedure for the second singleton and write the variable something like this:
vSeconds = string2date(substring(ParamDisplayValue('pDate'),1,10)) <> [Query2].[firstOfMonth]

In your case it might look a little different depending if your report is based on a cube or relational data

oscarca

Its even more simple with relational data:
Data item : [firstOfMonth] = cast(_first_of_month([C].[C_Sales_Details].[Dim_Calendar].[Date_1]) as date)
Layout Calculation: ReportDate() or Data item : current_date
vFirstOfMonth: string2date(substring(ParamValue('pDate'),1,10)) = [Query1].[firstOfMonth]
vOther: string2date(substring(ParamValue('pDate'),1,10)) <> [Query1].[firstOfMonth]

place the vFirstOfMonth render variable on the first singleton and vOther on the second singleton/or Layout calculation

tushar gaurav