How to allow comma separated values to be entered into a text box prompt ?
Use a filter expression to parse out the values. For example, a report has a prompt with parameter ?ParamZipCode? and is used to filter query item [Zip Code]
The filter expression would be as follows:
cast([Zip Code],varchar(200)) in ( #csv ( split(' ', split(',', split(' ,', split(' , ', split(', ', prompt('paramZipCode','token') ) ) ) ) ) ) # ) This filter converts the Zip Code to text and looks for the value IN a list of comma separated values. Due to the nature of the macro functions, the result of the function is a series of string elements. The cast function applied to a numeric field ensures that the appropriate data types are being used within the filter expression. The split() macro functions are in place to handle additional white space that users may enter between the comma-delimited values.
The filter expression would be as follows:
cast([Zip Code],varchar(200)) in ( #csv ( split(' ', split(',', split(' ,', split(' , ', split(', ', prompt('paramZipCode','token') ) ) ) ) ) ) # ) This filter converts the Zip Code to text and looks for the value IN a list of comma separated values. Due to the nature of the macro functions, the result of the function is a series of string elements. The cast function applied to a numeric field ensures that the appropriate data types are being used within the filter expression. The split() macro functions are in place to handle additional white space that users may enter between the comma-delimited values.
Comments
Post a Comment