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

Splitting URL path

Started by cogboy, 30 Oct 2007 12:03:46 PM

Previous topic - Next topic

cogboy

Hello Everyone

I have a cloumn which gives me URl paths for different file locations.
For Example:  http://cdrive/good/eater.pdf
                   http://fdrive/bater.pdf

So i need to extract only Bold part of url.Means i need to get only part after last '/'.

if any one have any ideas please share with me.

Thanks
Vin

COGNOiSe administrator


cogboy

Thanks for your response

url path is my query item.So I have to create a calculation which gives me
that file name.

I am unable to use lastindexof.

Please give me your suggestion.

Thanks
cogboy

almeids

if on Oracle try:
substr([url path],instr([url path],'/',-1)+1)

COGNOiSe administrator

Keep in mind thay you can add ANY function to Cognos Suite. Even a non-database one if I understand the Framework correctly. It is just a matter of how much effort would you like to invest.

cogboy

I am on Sql not on oracle but any ways i appreciate yur response

almeids

I imagine that your database has similar functions for extracting a portion of a string or locating a string within a string, perhaps you could extrapolate from the Oracle example.

praveennb

This should work on SQL Server.

Sample
declare @str varchar(50)
set @str='http://cdrive/good/eater.pdf'
select reverse(substring(reverse(@str),1,charindex('/',reverse(@str))-1))

in your  FM query replace the bold part with your column name
select reverse(substring(reverse(@str),1,charindex('/',reverse(@str))-1))