COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jaymoore1756 on 04 Dec 2012 04:14:05 PM

Title: How do you Render specific pages in Cognos using conditional variables
Post by: jaymoore1756 on 04 Dec 2012 04:14:05 PM
I have five letters (five pages) in a Cognos report. The letters are in response to NSF checks received by the company . Each letter is different and is generated based upon flags that are set in the NSF file. The letter gets generated in a collection stream process during the evening processing. I need to render 1 letter ( suppress 4 ) based upon the flags that have been set in the file. For example -- if the customer 1 has never had an NSF check. Then print a nice letter ( page 1). If the customer has had other NSF check then letter 2 ( page 2 ) and so on. The following is the conditional logic for printing the letters --- 1,2 3,4,5 represent each page.....

IF [Main].[RETURN_REASON_CD] = 'FINAL' Then '1' Else (
IF [Main].[RETURN_REASON_CD] = 'FIRST' AND [Main].[METHOD_OF_DRAFT_OVR] = 'ACHDA' Then '2' Else (
IF [Main].[RETURN_REASON_CD] = 'FIRST' AND [Main].[METHOD_OF_DRAFT_OVR] <> 'ACHDA' Then '3' Else (
IF [Main].[RETURN_REASON_CD] NOT IN( 'FIRST', 'FINAL') AND [Main].[METHOD_OF_DRAFT_OVR] = 'ACHDA' Then '4' Else  '5')))

When I run this in report studio all five pages are rendered.  Any help or assistance at creating the conditional variable would be greatly appreciated.
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: cognostechie on 04 Dec 2012 06:55:00 PM
Create a String Variable with your condition.

IF [Main].[RETURN_REASON_CD] = 'FINAL' Then 'One' Else (
IF [Main].[RETURN_REASON_CD] = 'FIRST' AND [Main].[METHOD_OF_DRAFT_OVR] = 'ACHDA' Then 'Two' Else (
..............


Add five values (one, two, three, four, five) Go to Report pages, click page1. In the 'Render Variable' property, select the variable you created. Select only one value (one) in the 'Render For' section. Click on Page2, repeat the same steps but select another value (two). Do the same for other pages.
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: jaymoore1756 on 05 Dec 2012 08:19:02 AM
ok I created a string variable and called it Retrn_Chk_Reason I added the values 1 - 5. At the page level, I rendered the string with one value and ran the report and got the following error.. ( see attachment ) Thanks
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: jaymoore1756 on 05 Dec 2012 08:36:58 AM
Update --- In the collection stream there is a detailed filter [WORK_TRXN_NO] = ?WorKTransNo? that is used to get the record for the letter. does that need to be included variable ?
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: blom0344 on 05 Dec 2012 10:02:28 AM
You probably forgot to associate a dataitem with the page (through the page properties) If you use a variable that refers to a dataitem that is not used in a datacontainer you need to associate it through the datacontainer properties setting
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: jaymoore1756 on 06 Dec 2012 04:59:51 AM
You probably forgot to associate a dataitem with the page (through the page properties) If you use a variable that refers to a dataitem that is not used in a datacontainer you need to associate it through the datacontainer properties setting  --

Can you give an example of this ..thanks
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: blom0344 on 06 Dec 2012 05:57:12 AM
Well, like I wrote. Suppose you define a variable against a data-item from a query that is not used in the datacontainer where the variable is developed for then the association does not exist. This typically leads to error messages like the one you get.
For report and list you can associate the dataitem through the properties 'properties' setting. For a crosstab you do this through the crosstab header (no idea why this is different)
Title: Re: How do you Render specific pages in Cognos using conditional variables
Post by: jaymoore1756 on 07 Dec 2012 03:41:28 PM
Thanks ...issue resolved