COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ravimahazan84 on 22 Nov 2012 06:51:40 AM

Title: How to use Regular Expression in report studio
Post by: ravimahazan84 on 22 Nov 2012 06:51:40 AM
Hi All,

Anyone having Idea how to use regular expression in report studio,please share your experience,Thanks.

Ravi
Title: Re: How to use Regular Expression in report studio
Post by: wyconian on 22 Nov 2012 10:02:57 AM
Whaat expression do you want to use?
Title: Re: How to use Regular Expression in report studio
Post by: ravimahazan84 on 22 Nov 2012 12:21:42 PM
hi,

For example employee name contains some specific special character pattern then i want to apply regular expression for the same to identify all such name with that pattern.

thanks
Title: Re: How to use Regular Expression in report studio
Post by: wyconian on 23 Nov 2012 07:02:34 AM
If you can code it you can add it to the query as a query item or calculation
Title: Re: How to use Regular Expression in report studio
Post by: norkos on 26 Nov 2012 03:42:39 AM
Cognos dosn't support regexp filter by default, but there are tricky workarounds.

First you have to check, that you DB provider support regexp or not - like Oracle regexp_like filter function.
If your DB provider support such functions, than you have to configure Cognos to interpret this new function.
To do this you have to modify some XML files, which is quity tricky. I recommend to make it only if you can't create the filter with common function.

If you can't create you filter with common functions as substring and like, then let me know and I will send you detailed information about the XML modification.
Title: Re: How to use Regular Expression in report studio
Post by: ravimahazan84 on 27 Nov 2012 01:39:24 AM
Hi Wyconcian,

Do u have any example with you as i can write code for the same but where to add it.

Hi Nor,

Can u send me that XML thing it will be helpful to me.
my email address is   <removed>
Title: Re: How to use Regular Expression in report studio
Post by: wyconian on 27 Nov 2012 02:45:19 AM
I would just drag a data item or calculation onto your report/query and add there code there
Title: Re: How to use Regular Expression in report studio
Post by: blom0344 on 27 Nov 2012 03:30:32 AM
Quote from: norkos on 26 Nov 2012 03:42:39 AM
First you have to check, that you DB provider support regexp or not - like Oracle regexp_like filter function.
If your DB provider support such functions, than you have to configure Cognos to interpret this new function.

This would mean adding native functions to the package definition the report works on. You can add these in the package definition prior to publishing..
Title: Re: How to use Regular Expression in report studio
Post by: norkos on 27 Nov 2012 07:43:24 AM
@Blom: It doesn't mean just addig vendor specific function set to the package in FWM prior publishing, bacause the correspondent Cognos config files don't contain all DB level functions. E.q.: They don't contain the regexp_like Oracle function even you have add Oracle functions to the package. So in some cases this need also XML modifications prior you can add the new function to your package.

@Ravi: Here you can find a detailed description from IBM about how to add new DB functions - also user-defined - to your Cognos system: http://www-01.ibm.com/support/docview.wss?uid=swg21339781 (http://www-01.ibm.com/support/docview.wss?uid=swg21339781)
If your Cognos has a multiserver architecture than you have to do the same modifications on every nodes.
Title: Re: How to use Regular Expression in report studio
Post by: blom0344 on 27 Nov 2012 03:20:57 PM
Fair enough, but the point I was trying to make is that you need to enable working with native RDBMS functions in the first place through the methode described..