COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: trooper642 on 05 Jun 2008 09:12:27 AM

Title: extract certain parts of a dynamic string
Post by: trooper642 on 05 Jun 2008 09:12:27 AM
Hi,

I would like to extract certain parts of a dynamic string.
I have a multi select value prompt pulling the field [Division Number â€" Name] with the parameter name = pDivisionNoName.

Example:
pDivisionNoName = “001 â€" Div A, 002 â€" Div B, 004 â€" Div D”
I would like to produce this “001, 002, 004” just extracting the number before the “-“.
-----------------------
I used the below expression with success when setting the prompt to single select.
substring(?pDivisionNoName?,1,(position(' - ',?pDivisionNoName?)-1))

The parameter value is coming from a parent drill through report in RS with a cube data source.
If I can explain/ provide any more detail please let me know.

-Bryan
Title: Re: extract certain parts of a dynamic string
Post by: kattaviz on 11 Jun 2008 01:09:40 PM
Hi,
If u r using the Division code(001) as use value in the parameter, u can display those values using the syntax "paramValue(parametername)".

For example;
Your value prompt displays the division names but uses the division codes to filter the data in the report, then use the code "paramValue(parametername" to disolay only the dicision codes.

HTH
Title: Re: extract certain parts of a dynamic string
Post by: trooper642 on 11 Jun 2008 02:45:26 PM
My parameter comes from a parent drill through cube report and I’m only able to pass the visible value from the report which contains a combination of “Number - Name”. In the cube I have 2 separate dimension containing “Number â€" Name” and “Number” but they don’t stay in sink with each other because there is no relation between the two. The reason why I want to extract the number is due to the warehouse “Division Number” field being indexed.

-Bryan