COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: VisioX on 21 Oct 2009 11:51:38 AM

Title: [Solved] Skip prompt page based on record count?
Post by: VisioX on 21 Oct 2009 11:51:38 AM
Hi,

I try to figure out following problem.
When a branch manager is running (interactive) report "A", he gets the report based on how many branches he has access to: 1 branch, 2 branches, etc.
Now, for branch managers with access to more than one branch I added a prompt page, so he can pick and choose which branch(es) he would like to see (still depending on his access level).
Now my question: How can I skip the prompt page for managers with access to only one branch?

Thanks!


Never mind, figured it out.
Title: Re: [Solved] Skip prompt page based on record count?
Post by: billylodz on 22 Oct 2009 03:13:29 AM
tell us
Title: Re: [Solved] Skip prompt page based on record count?
Post by: lindero on 22 Oct 2009 06:26:25 AM
certainly with the render variable in the page properties.

That's the way I would do.
Title: Re: [Solved] Skip prompt page based on record count?
Post by: Gopinath on 22 Oct 2009 09:36:15 AM
Create a variable count([Branch] for Report) > 1

and render the prompt page accordingly
Title: Re: [Solved] Skip prompt page based on record count?
Post by: VisioX on 22 Oct 2009 11:15:17 AM
I tried a lot of ideas.
Here is what worked for me:

First I created a query with native SQL to get my branch-count done, depending on the user access:
{
if (
select "T1"."USRMA" AS "USRMA"
from "SunstateBI"."dbo"."dUserMapping" "T1"
where "T1"."ADACT" = #sq($account.personalInfo.userName)# and "T1"."USRMA" = 'Y'
) IS NULL
begin
select distinct count("Location"."ZLLOC") AS "ZLLOCCount"
from "SunstateBI"."dbo"."dLocation" "Location"
left outer join "SunstateBI"."dbo"."CBUMAPPF" "CBUMAPPF" on "ZLLOC" = "CBUMAPPF"."BRNCD" or "ZRRGN" = "CBUMAPPF"."RGNCD"
where "CBUMAPPF"."ADACT" = #sq($account.personalInfo.userName)# and "ZLLOC" between 'A00' and 'ZZZ'
end else
begin
select count("Location"."ZLLOC") AS "ZLLOCCount"
from "SunstateBI"."dbo"."dLocation" "Location"
end
}


Now I went to the 'Prompt Pages" and clicked once on my 'Prompt Page1' and added my 'LocationCount' query to the 'Query" option and added 'ZLLOCCount' to the data-Properties.

Inside the prompt page I have my 'Value Prompt' defined as Required=Yes, Multi-Select=Yes, Select-UI=List box and Auto-Submit=No

Somewhere in the header of the prompt page I added an HTML-Item.
<script type="text/javascript">
setTimeout('oCV_NS_.promptAction(\'finish\')', 100)
</script>

This HTML Item has a Render Variable 'Single_Branch' as boolean
[LocationCount].[ZLLOCCount] = 1

I also changed the propertied for 'Page Body' and 'Page Footer' by adding a Conditional Style called 'Just 1 Count', which is
[LocationCount].[ZLLOCCount] = 1 with box-type 'none'