Wednesday, January 30, 2013

Text Box prompt with Comma Seperated Values in Cognos 8.x

The following technique allows users to enter comma separated values into a text box prompt.

Use a filter expression to parse out the values. For example, a report has a prompt with parameter ?Id? and is used to filter query item [Id]

The filter expression would be as follows:

cast([Id],varchar(200)) in ( #csv ( split(' ', split(',', split(' ,', split(' , ', split(', ', prompt('Id','token') ) ) ) ) ) ) # )


  1. This filter converts the Id to text and looks for the value IN a list of comma separated values.
  2.  Due to the nature of the macro functions, the result of the function is a series of string elements. 
  3. The cast function applied to a numeric field ensures that the appropriate data types are being used within the filter expression. 
  4. The split() macro functions are in place to handle additional white space that users may enter between the comma-delimited values. 
  5. It allows you to enter multiple Order Numbers separated by commas, in a text box prompt.


when  you runt he reports it asks you to enter the values in text box prompt.
there enter 1,2,3 and then click on finish

it will give the data for Ids 1,2 and 3.


No comments:

Post a Comment