COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Active Reports => Topic started by: Arhinoa on 28 Aug 2014 07:16:29 AM

Title: Using active report variable value in a dataItem
Post by: Arhinoa on 28 Aug 2014 07:16:29 AM
Hi!

We're having an issue with the value of an active report variable.
Actually, the value contains an "_" and this character is not to be displayed to the end users.

We'd like to know if there is a solution to pass the value of the variable in a data item so that we can treat the underscore and display a value without it.
In fact, if someone has an idea about how to display the value without an underscore, I'm more than interested.

I'm not sure I'm clear, don't hesitate to ask questions.


Regards,
Arhinoa.

Title: Re: Using active report variable value in a dataItem
Post by: bdbits on 28 Aug 2014 09:12:15 AM
I think macros work in Active Reports, so you could use something like this.

#sq ( substitute ( '_',' ','remove_underscores') )#

The first string is what you want to search for, in this case an underscore.
The second string is what you want to replace it with, in this case a space.
The third string is the expression to modify. I used a string but it can be a column with a string value.
Title: Re: Using active report variable value in a dataItem
Post by: Arhinoa on 28 Aug 2014 09:54:04 AM
Thanks for your response bdbits.
You are right. Macros also work with AR.
The thing is that we don't know how to catch the current value of the active report variable (the 3rd parameter in your macro).
We can display it in a variable text item but we hadn't found a way to modify it in order to delete the underscore.
Title: Re: Using active report variable value in a dataItem
Post by: MFGF on 28 Aug 2014 12:13:57 PM
Quote from: Arhinoa on 28 Aug 2014 09:54:04 AM
Thanks for your response bdbits.
You are right. Macros also work with AR.
The thing is that we don't know how to catch the current value of the active report variable (the 3rd parameter in your macro).
We can display it in a variable text item but we hadn't found a way to modify it in order to delete the underscore.

Hi,

The values you find in a variable are populated in one of only two ways:

1. They are manually defined
2. They are defined by the values in a data item

If the variable values are manually defined, all you need to do is to change the definition of the variable in question so it doesn't contain an underscore
If the variable values are populated by a data item, you can replace this data item with a query calculation that strips out the underscore from the values in the data item.

Cheers!

MF.
Title: Re: Using active report variable value in a dataItem
Post by: Arhinoa on 17 Sep 2014 04:49:09 AM
Hi!
Sorry for not responding.
We found a workaround!
We had a confirmation from IBM that it was impossible to modify the value of an active report the way we wanted.

So we created another crosstab just for displaying without the underscore. We inserted only one data into that crosstab: the data item source of our AR variable, filtered by the actual value of the variable. 
Then, we added a report expression to the crosstab, where we deleted the underscore.

Thanks for your help!