If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How to implememt regex feature in cognos report studio

Started by nsaxena, 23 Mar 2017 04:19:54 PM

Previous topic - Next topic

nsaxena

Hello All,

I have a string column from which i need to extract all columns containing 'XXX' AND 'YY' . These two can appear at any length of string but will always be together(i.e 3X will be together and 2 Y will b together).

Please suggest how to implement this.
Database is DB2

Lynn

Quote from: nsaxena on 23 Mar 2017 04:19:54 PM
Hello All,

I have a string column from which i need to extract all columns containing 'XXX' AND 'YY' . These two can appear at any length of string but will always be together(i.e 3X will be together and 2 Y will b together).

Please suggest how to implement this.
Database is DB2

Find out if your version of DB2 has support for regexp built-in functions.

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/db2/rbafzscaregexp_instr.htm

Also consider the locate or position function to identify if the column has the string or not.

hespora

If existence of those partial strings is all you're looking for, especially without any demands to the surroundings of the partial strings, you don't need regex for that.

if(
  (position('XXX',[string])>0) and (position('YY',[string])>0)
  )
then (1)
else (0)

and filter for 1

Invisi

There is also the function 'contains' that you can also use in query filters.
Few can be done on Cognos | RTFM for those who ask basic questions...