COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: lookingforK on 07 May 2013 02:21:43 PM

Title: How to trim ParamDisplayValue('Para1') that shows trailing spaces?
Post by: lookingforK on 07 May 2013 02:21:43 PM
Hi,

I create a prompt page with a parameter 'Para1' that is supposed to be part of a dynamic title.

I add a Layout Calculation for the title, and use: ParamDisplayValue('Para1').

I run the report and find there are trailing spaces at the end of the string generated from ParamDisplayValue('Para1').

But I can't   use TRIM function to trim ParamDisplayValue('Para1'), i.e.:
I get error message when I use trim(TRAILING, ,ParamDisplayValue('Para1')).

How to deal with this issue and trim the string from the parameter?

Thank you in advance.
Title: Re: How to trim ParamDisplayValue('Para1') that shows trailing spaces?
Post by: Lynn on 08 May 2013 09:40:08 AM
Try this:

trim(TRAILING, ' ' ,ParamDisplayValue('Para1'))
Title: Re: How to trim ParamDisplayValue('Para1') that shows trailing spaces?
Post by: lookingforK on 08 May 2013 01:09:57 PM
Thank you Lynn,

I tried your expression...

But it could not work.
Title: Re: How to trim ParamDisplayValue('Para1') that shows trailing spaces?
Post by: Lynn on 08 May 2013 01:24:16 PM
The best thing generally is to provide any error messages or explanation about what didn't work.

I did not notice originally that you also omitted quotes around trailing. Try this. And if it doesn't work you'll know what to respond back with  ;D

trim( 'trailing', ' ', ParamDisplayValue('Para1') )
Title: Re: How to trim ParamDisplayValue('Para1') that shows trailing spaces?
Post by: lookingforK on 14 May 2013 02:23:24 PM
Thank you Lynn.

It works ... :)