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

Last positon in string REPORT STUDIO

Started by andregomes, 25 May 2017 01:33:58 PM

Previous topic - Next topic

andregomes

Good afternoon people,
Sorry for my english first and I have a problem.

I need to get the last occurrence of a char in a string and make the substring from that position.
For example

I have some strings
'Www.google.com'
'Www.bbc.com'
'Www.university.edu'
I need to return now
'com'
'com'
'Edu'
how to make ?



I tried using the Position function in the report studio but the '.' Is in different positions, so I need to get the last occurrence of '.' And use the substring from that point.

Thank you

Niranjan81

I would do a string reverse , calculate upto the char that's needed using substr( , . )
and then reverse the final output using strrev again.

andregomes

Thank you,
But I do not know how to do this reverse calculation.

Position ('.'; [Field]) returns me the first position, but how to return the last?

Niranjan81

which db are you using ?
If you want to use cognos function - its REVERSE.

Thanks
NC


andregomes

ITS WORKS.... thank you so much.

you save my day.

Niranjan81