Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: retrieving substring Post Reply Post New Topic
Author Message
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Topic: retrieving substring
    Posted: 04 Feb 2014 at 4:59pm
I wish to get a substring of data from a column which has URL.
example: http://www.xyz.com/region/department.asp?FID=8907.
I wish to retrieve only department.asp and trim anything that is before and after it. so ?FID=8907 and http://www.xyz.com/region/ shouldn't be in the derived column. Later I will be joining this column (department.asp) to another column. I understand that this is more SQL question than crystal but I am using this in my report. Any pointers appreciated.


Edited by trac - 04 Feb 2014 at 5:04pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 Feb 2014 at 12:21pm
This isn't necessarily a SQL question - this can be done through a Crystal formula.

I might try something like this using arrays and the Split function:

StringVar Array url := Split({MyTable.URLField}, "/");
StringVar Array txt := Split(url, "?");
txt[1]

The first line will split the data based on the "/" character, so that the last element of the array, based on your example, will contain "department.asp?FID=8907".

The next line will split the data based on the "?" so that the first element of the array will contain "department.asp".

Note that the third line has no semi-colon on the end of it while the other two lines do. This lack of semi-colon tells Crystal that this is the value that needs to be displayed or passed to another formula.

-Dell

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.