Girish
Girish

Reputation: 49

Cognos Static prompt values to be passed to SQL

I have a static prompt which is a single select. In that I have two values lets call it A and B. So when I select option 'A' my report pulls all data from the DB which is expected. So when user Select option 'B' the report should pull only the records whose code = 'M'. Here code is a column name in the report.

Note: For option 'A' I don't need to set any prompt in the report because it should pull all records by default.

Upvotes: 1

Views: 865

Answers (2)

VAI Jason
VAI Jason

Reputation: 544

I think I understand, try this:

  • Make the prompt a single value (i.e. B) with a use value of 'M'
  • Make the HEADER TEXT for the prompt A (so it is not an actual selection)
  • Make the filter optional

if the user selects A - the prompt is NULL and the optional filter is ignored if the user selects B - the filter [Some data item] = ?YourParm? will occur

Also, if you prefer to not have header text you can make static values A, B and modify the optional filter to be like this:

  • (?YourParm? <> 'M') OR ([Some data item] = ?YourParm?)

Upvotes: 1

dougp
dougp

Reputation: 3089

Let's assume your parameter name is param and data item is named item.

Filter expression:

if (?param? = 'A')
then ([item])
else ('M')
 = [item]

Note: You absolutely need to use a prompt. The result of selecting A should be to not filter.

Upvotes: 1

Related Questions