COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tarunkrdas2013 on 08 Oct 2015 04:51:04 PM

Title: Page rendering not happening with render variable when user selects future date
Post by: tarunkrdas2013 on 08 Oct 2015 04:51:04 PM
Created 4 report pages with names PDF US,PDF CN,HTML,NO DATA,then Created Render variable of string type, named variable as var_PageRender and string values are

PDF US --->when user selects PDF as report output and country as US
PDF CN --->when user selects PDF as report output and country as CN
HTML  --->when user selects HTML as report output and report date as today or less than today
NO DATA  --->when user selects PDF as report output and report date as Future date than today's date

and in each report page went to Render variable property and assigned the checkboxes like PDF US,PDF CNHTML,NO DATA respectively to each page to var_PageRender

And expression definition for var_PageRender is

case

when 
( [Query1].[Data Item2]> [Query1].[Data Item1]) then 'NO DATA'

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'UNITED STATES' and
([Query1].[Data Item2] >= [Query1].[Data Item1]) then 'PDF US'

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'CANADA' and
([Query1].[Data Item2] >= [Query1].[Data Item1]) then 'PDF CN'

when ReportOutput () = 'HTML' and
([Query1].[Data Item2] = [Query1].[Data Item1]) then 'HTML'

end

Here [Data Item2] is ?p_Date?
and [Data Item1] descendants(members([Hierarchical].[Fiscal Calendar].[Yesterday]), 2)

I thought its simple to render to Report pages  but problem is after running report when i select some future date ,ideally 'NO DATA' report page should be displayed
but page rendering not happening as expected
Title: Re: Page rendering not happening with render variable when user selects future date
Post by: tarunkrdas2013 on 08 Oct 2015 04:52:50 PM
Instaed of showing  'NO DATA' page ,report is by default going to HTML page ,this is the exact problem
Title: Re: Page rendering not happening with render variable when user selects future date
Post by: SG1907 on 09 Oct 2015 04:56:23 AM
Your case statement does not have else condition.

you are saying that HTML page is rendered when a future date is selected.

can you let us know what country data is displayed in this HTML page.

Title: Re: Page rendering not happening with render variable when user selects future date
Post by: Lynn on 09 Oct 2015 05:16:30 AM
If this is a dimensional package then your dates are not really dates. They are members of a hierarchy identified by MUNs. Given your use of dimensional functions I am assuming a dimensional source.

The concept of greater than or less than isn't really the same thing. Also, your [data item1] is using a descendants function which returns a SET of members. Even if there is only one descendant for the Yesterday member the result is still considered a set.

You'd probably need some relative time hierarchy in your source to do what you are describing unless I am totally misunderstanding the situation.
Title: Re: Page rendering not happening with render variable when user selects future date
Post by: tarunkrdas2013 on 09 Oct 2015 04:33:30 PM
Lynn you are a master ,as you said i created a Date Item  and relative time filters  instead of dimensional expression,my report is rendering now updated expression for render variable

var_PageRender is

case

when

(string2date(ParamValue('p_Date')) > ([Query1].[Data Item1])) then ('NO DATA')

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'UNITED STATES' and
(string2date(ParamValue('p_Date')) < ([Query1].[Data Item1])) then ('PDF US')

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'CANADA' and
(string2date(ParamValue('p_Date')) < ([Query1].[Data Item1]))then ('PDF CN')

when ReportOutput () = 'HTML' and
(string2date(ParamValue('p_Date')) <= ([Query1].[Data Item1]))then ('HTML')

end

Here [Query1].[Data Item1] has expression taken from Relational model as [Presentation].[Date].[Dt] and filters as [Presentation].[Date].[Days from Curr Dt]=0



Title: Re: Page rendering not happening with render variable when user selects future date
Post by: Lynn on 12 Oct 2015 02:36:14 AM
Quote from: TKD on 09 Oct 2015 04:33:30 PM
Lynn you are a master ,as you said i created a Date Item  and relative time filters  instead of dimensional expression,my report is rendering now updated expression for render variable

var_PageRender is

case

when

(string2date(ParamValue('p_Date')) > ([Query1].[Data Item1])) then ('NO DATA')

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'UNITED STATES' and
(string2date(ParamValue('p_Date')) < ([Query1].[Data Item1])) then ('PDF US')

when ReportOutput () = 'PDF' and
ParamDisplayValue('pmt_Country') = 'CANADA' and
(string2date(ParamValue('p_Date')) < ([Query1].[Data Item1]))then ('PDF CN')

when ReportOutput () = 'HTML' and
(string2date(ParamValue('p_Date')) <= ([Query1].[Data Item1]))then ('HTML')

end

Here [Query1].[Data Item1] has expression taken from Relational model as [Presentation].[Date].[Dt] and filters as [Presentation].[Date].[Days from Curr Dt]=0

Is it a dimensional source or isn't it? Your expression is still using relational concepts rather than dimensional ones.
Title: Re: Page rendering not happening with render variable when user selects future date
Post by: tarunkrdas2013 on 13 Oct 2015 11:09:32 AM
Yes its a dimensional source built on top of relational model