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 the substring function will work

Started by jd, 21 Dec 2009 12:56:40 PM

Previous topic - Next topic

jd


I am confused how the substring function will work what will be the output for below syntex;

Year/Month = substring(?p_yearmonth?, 3, 4)+ substring(?p_yearmonth?, 8, 2)

angela

Substring takes a value (in your case a parameter) and returns certain characters for a certain length.

Year/Month = substring(?p_yearmonth?, 3, 4)+ substring(?p_yearmonth?, 8, 2)

Your filter says:
[The Year/Month data item] = the third position of the parameter chosen for 4 characters + the eigth position of the chosen parameter for 2 characters.

But I can't think of any parameter value a person would pick that would result in at least 9 digits.

Here's a more common one assuming the parameter the person picks is '2009-10':
Year/Month = substring(?p_yearmonth?, 1, 4)+ substring(?p_yearmonth?, 6, 2)

Another problem you might have is that it might think it should ADD instead of CONCATENATE.  If that happens you'll need to cast the parts as character instead of integer which wants to do math.