COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: davidcognos on 15 May 2019 08:50:49 PM

Title: Disable the prompts based on user login
Post by: davidcognos on 15 May 2019 08:50:49 PM

Hi,

I have a requirement of disabling the prompts in the prompt page based on a user login and enable one prompt. Lets say the user belongs to 2 of the manager groups, then we need a prompt  t, which will have the 2 Manager type values(static choices) to pick and there are 2 more additional prompts in the prompt page,  which needs disabling based on the user login. These 2 additional prompts are also getting validated because one of the manager type value is present in 2 prompts. But I need to disable these 2 prompts and instead use only one prompt which consists of the 2 manager type values in one prompt only.

These 2 prompts are placed inside a table and already have a conditional variable which evaluates the manager types. If the manager is region1, then render varible is assigned to 1st prompt and for 2nd prompt if the manager is region2, then render varible is assigned to 2nd prompt. When the particular user login, and as he is part of both the groups, these 2 prompts are also getting enabled and displayed which the user dont want and want only only prompt which will have both manager types values in prompt and disable these 2 prompts.


I am trying by creating another boolean variable using the  macro  sq($account.personalInfo.userName)# = 'user_name',  then hide the 2 prompts based on this variable condition, but it is not working and throws the invalid syntax. Any idea?
Title: Re: Disable the prompts based on user login
Post by: BigChris on 16 May 2019 01:55:59 AM
The format for your macro doesn't look right

sq($account.personalInfo.userName)# = 'user_name'

Should there be an opening # , and are the brackets in the right place?
Title: Re: Disable the prompts based on user login
Post by: davidcognos on 16 May 2019 04:13:51 AM
I am using the  #sq($account.personalInfo.userName)# = 'user_name' only but it throws the error as 
'  Invalid expression #sq($account.personalInfo.userName)#= 'username'. CRX-YXX-4010 A parsing error was found at or near the position 0 in the expression "#sq($account.personalInfo.userName)#= 'username' ".
Title: Re: Disable the prompts based on user login
Post by: dougp on 16 May 2019 06:15:41 PM
I see a similar error.

I'm using Cognos 11.0.13, but one thing I noticed:  There is no Macros tab in the Report expression dialog when editing a Variable in Condition explorer.  Maybe macros can't be used in this context.
Title: Re: Disable the prompts based on user login
Post by: MFGF on 20 May 2019 09:18:08 AM
Quote from: dougp on 16 May 2019 06:15:41 PM
I see a similar error.

I'm using Cognos 11.0.13, but one thing I noticed:  There is no Macros tab in the Report expression dialog when editing a Variable in Condition explorer.  Maybe macros can't be used in this context.

I'm pretty sure variable expressions need to refer to items defined in the query, and actively used in a report container. Try adding your expressions into query items, add these as properties of your container (eg list, crosstab edge etc). and then refer to these items in your variable expression. Does that work?

MF.